Upload
builien
View
232
Download
0
Embed Size (px)
Citation preview
P Koppenburg
Introduction to DaVinci
bull Overviewbull First trybull Writing a simple algorithmbull Configuring Common Algorithmsbull More about Toolsbull Accessing MC truth
This session is not hands-on but there are manyexamples one can try ldquoat homerdquo
Patrick Koppenburg
Introduction to DaVincimdash November 2004 Software week ndash p 185
P Koppenburg
Overviewbull Assumptions
bull LHCb applications structure
bull DaVinci structure
bull Documentation sources
Introduction to DaVincimdash November 2004 Software week ndash p 285
P Koppenburg
Assumptionsbull It is assumed that you know (a little) about
bull cmt bull Gaudi (some of it)bull a few LHCb conventionsbull C++
bull If not have a look at the Gaudi tutorial (here) or at theGaudi documentation
I assume the typical public for this tutorial are people who justdid the Gaudi hands-on and would like to start using DaVinci
I may well be wrong
Introduction to DaVincimdash November 2004 Software week ndash p 385
P Koppenburg
Assumptionsbull It is assumed that you know (a little) about
bull cmt bull Gaudi (some of it)bull a few LHCb conventionsbull C++
bull If not have a look at the Gaudi tutorial (here) or at theGaudi documentation
I assume the typical public for this tutorial are people who justdid the Gaudi hands-on and would like to start using DaVinci
I may well be wrong
Donrsquot hesitate to interrupt
and to ask questions
Or to correct mistakes
Introduction to DaVincimdash November 2004 Software week ndash p 385
P Koppenburg
Conventions
Colour-codingbull Words in Green are links to other pagesbull Words in Blue are links to web pages
Fontsbull Fixed-width fonts are for code and options
bull gt echo This is a shell command
If it is boxed then it is directlycopied from a h cpp or opts file
Introduction to DaVincimdash November 2004 Software week ndash p 485
P Koppenburg
DaVinci Linksbull DaVinci web page
httplhcb-compwebcernchlhcb-compAnalysisdefaulthtmFrom there yoursquoll find bull Some documentationbull A ldquogetting startedrdquo guidebull FAQ
bull Any question can be asked at the DaVinci mailing listlhcb-davincicernch
bull Thatrsquos also the forum to propose improvements ofDaVinci
bull You need to be registered to use it Contact thesecretariat at lhcbsecretariatcernch
bull I am writing a reference guide for the ldquocorerdquo DaVinci code
Introduction to DaVincimdash November 2004 Software week ndash p 585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
bull There are four applications based on Gaudi
bull They are actually all Gaudi-programsbull The only difference are the packages (shared
libraries) includedbull One could easily build an application that does it all
(like in the old SICB days )bull Somewhere here Panoramix and Bender are missing
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Overviewbull Assumptions
bull LHCb applications structure
bull DaVinci structure
bull Documentation sources
Introduction to DaVincimdash November 2004 Software week ndash p 285
P Koppenburg
Assumptionsbull It is assumed that you know (a little) about
bull cmt bull Gaudi (some of it)bull a few LHCb conventionsbull C++
bull If not have a look at the Gaudi tutorial (here) or at theGaudi documentation
I assume the typical public for this tutorial are people who justdid the Gaudi hands-on and would like to start using DaVinci
I may well be wrong
Introduction to DaVincimdash November 2004 Software week ndash p 385
P Koppenburg
Assumptionsbull It is assumed that you know (a little) about
bull cmt bull Gaudi (some of it)bull a few LHCb conventionsbull C++
bull If not have a look at the Gaudi tutorial (here) or at theGaudi documentation
I assume the typical public for this tutorial are people who justdid the Gaudi hands-on and would like to start using DaVinci
I may well be wrong
Donrsquot hesitate to interrupt
and to ask questions
Or to correct mistakes
Introduction to DaVincimdash November 2004 Software week ndash p 385
P Koppenburg
Conventions
Colour-codingbull Words in Green are links to other pagesbull Words in Blue are links to web pages
Fontsbull Fixed-width fonts are for code and options
bull gt echo This is a shell command
If it is boxed then it is directlycopied from a h cpp or opts file
Introduction to DaVincimdash November 2004 Software week ndash p 485
P Koppenburg
DaVinci Linksbull DaVinci web page
httplhcb-compwebcernchlhcb-compAnalysisdefaulthtmFrom there yoursquoll find bull Some documentationbull A ldquogetting startedrdquo guidebull FAQ
bull Any question can be asked at the DaVinci mailing listlhcb-davincicernch
bull Thatrsquos also the forum to propose improvements ofDaVinci
bull You need to be registered to use it Contact thesecretariat at lhcbsecretariatcernch
bull I am writing a reference guide for the ldquocorerdquo DaVinci code
Introduction to DaVincimdash November 2004 Software week ndash p 585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
bull There are four applications based on Gaudi
bull They are actually all Gaudi-programsbull The only difference are the packages (shared
libraries) includedbull One could easily build an application that does it all
(like in the old SICB days )bull Somewhere here Panoramix and Bender are missing
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Assumptionsbull It is assumed that you know (a little) about
bull cmt bull Gaudi (some of it)bull a few LHCb conventionsbull C++
bull If not have a look at the Gaudi tutorial (here) or at theGaudi documentation
I assume the typical public for this tutorial are people who justdid the Gaudi hands-on and would like to start using DaVinci
I may well be wrong
Introduction to DaVincimdash November 2004 Software week ndash p 385
P Koppenburg
Assumptionsbull It is assumed that you know (a little) about
bull cmt bull Gaudi (some of it)bull a few LHCb conventionsbull C++
bull If not have a look at the Gaudi tutorial (here) or at theGaudi documentation
I assume the typical public for this tutorial are people who justdid the Gaudi hands-on and would like to start using DaVinci
I may well be wrong
Donrsquot hesitate to interrupt
and to ask questions
Or to correct mistakes
Introduction to DaVincimdash November 2004 Software week ndash p 385
P Koppenburg
Conventions
Colour-codingbull Words in Green are links to other pagesbull Words in Blue are links to web pages
Fontsbull Fixed-width fonts are for code and options
bull gt echo This is a shell command
If it is boxed then it is directlycopied from a h cpp or opts file
Introduction to DaVincimdash November 2004 Software week ndash p 485
P Koppenburg
DaVinci Linksbull DaVinci web page
httplhcb-compwebcernchlhcb-compAnalysisdefaulthtmFrom there yoursquoll find bull Some documentationbull A ldquogetting startedrdquo guidebull FAQ
bull Any question can be asked at the DaVinci mailing listlhcb-davincicernch
bull Thatrsquos also the forum to propose improvements ofDaVinci
bull You need to be registered to use it Contact thesecretariat at lhcbsecretariatcernch
bull I am writing a reference guide for the ldquocorerdquo DaVinci code
Introduction to DaVincimdash November 2004 Software week ndash p 585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
bull There are four applications based on Gaudi
bull They are actually all Gaudi-programsbull The only difference are the packages (shared
libraries) includedbull One could easily build an application that does it all
(like in the old SICB days )bull Somewhere here Panoramix and Bender are missing
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Assumptionsbull It is assumed that you know (a little) about
bull cmt bull Gaudi (some of it)bull a few LHCb conventionsbull C++
bull If not have a look at the Gaudi tutorial (here) or at theGaudi documentation
I assume the typical public for this tutorial are people who justdid the Gaudi hands-on and would like to start using DaVinci
I may well be wrong
Donrsquot hesitate to interrupt
and to ask questions
Or to correct mistakes
Introduction to DaVincimdash November 2004 Software week ndash p 385
P Koppenburg
Conventions
Colour-codingbull Words in Green are links to other pagesbull Words in Blue are links to web pages
Fontsbull Fixed-width fonts are for code and options
bull gt echo This is a shell command
If it is boxed then it is directlycopied from a h cpp or opts file
Introduction to DaVincimdash November 2004 Software week ndash p 485
P Koppenburg
DaVinci Linksbull DaVinci web page
httplhcb-compwebcernchlhcb-compAnalysisdefaulthtmFrom there yoursquoll find bull Some documentationbull A ldquogetting startedrdquo guidebull FAQ
bull Any question can be asked at the DaVinci mailing listlhcb-davincicernch
bull Thatrsquos also the forum to propose improvements ofDaVinci
bull You need to be registered to use it Contact thesecretariat at lhcbsecretariatcernch
bull I am writing a reference guide for the ldquocorerdquo DaVinci code
Introduction to DaVincimdash November 2004 Software week ndash p 585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
bull There are four applications based on Gaudi
bull They are actually all Gaudi-programsbull The only difference are the packages (shared
libraries) includedbull One could easily build an application that does it all
(like in the old SICB days )bull Somewhere here Panoramix and Bender are missing
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Conventions
Colour-codingbull Words in Green are links to other pagesbull Words in Blue are links to web pages
Fontsbull Fixed-width fonts are for code and options
bull gt echo This is a shell command
If it is boxed then it is directlycopied from a h cpp or opts file
Introduction to DaVincimdash November 2004 Software week ndash p 485
P Koppenburg
DaVinci Linksbull DaVinci web page
httplhcb-compwebcernchlhcb-compAnalysisdefaulthtmFrom there yoursquoll find bull Some documentationbull A ldquogetting startedrdquo guidebull FAQ
bull Any question can be asked at the DaVinci mailing listlhcb-davincicernch
bull Thatrsquos also the forum to propose improvements ofDaVinci
bull You need to be registered to use it Contact thesecretariat at lhcbsecretariatcernch
bull I am writing a reference guide for the ldquocorerdquo DaVinci code
Introduction to DaVincimdash November 2004 Software week ndash p 585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
bull There are four applications based on Gaudi
bull They are actually all Gaudi-programsbull The only difference are the packages (shared
libraries) includedbull One could easily build an application that does it all
(like in the old SICB days )bull Somewhere here Panoramix and Bender are missing
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
DaVinci Linksbull DaVinci web page
httplhcb-compwebcernchlhcb-compAnalysisdefaulthtmFrom there yoursquoll find bull Some documentationbull A ldquogetting startedrdquo guidebull FAQ
bull Any question can be asked at the DaVinci mailing listlhcb-davincicernch
bull Thatrsquos also the forum to propose improvements ofDaVinci
bull You need to be registered to use it Contact thesecretariat at lhcbsecretariatcernch
bull I am writing a reference guide for the ldquocorerdquo DaVinci code
Introduction to DaVincimdash November 2004 Software week ndash p 585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
bull There are four applications based on Gaudi
bull They are actually all Gaudi-programsbull The only difference are the packages (shared
libraries) includedbull One could easily build an application that does it all
(like in the old SICB days )bull Somewhere here Panoramix and Bender are missing
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
bull There are four applications based on Gaudi
bull They are actually all Gaudi-programsbull The only difference are the packages (shared
libraries) includedbull One could easily build an application that does it all
(like in the old SICB days )bull Somewhere here Panoramix and Bender are missing
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Applications
Gauss
(simulation)
Boole
(digitization)
Brunel
(reconstruction)
DaVinci
(analysis)
Gaudi-Applications
sim digi dst dst
Data
Introduction to DaVincimdash November 2004 Software week ndash p 685
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Packages
DaVinci is a set ofpackages containingthe code necessaryto build a shared li-brary and the rele-vant options
They all have thesub-directories cmtsrc and options
See the Gaudi tuto-rial for an explanationof the package struc-ture
bull DaVinci-specific packagesPhys Physics algorithms and
tools (16 packages)Tools Other tools (2) LoKi (2)PhysSel Specific decay
channel selections (28)
bull Borrowed to be able to redothingsCalo Muon Detector-specific
PID packages (3)L0 Trg Hlt Trigger (19)Rec Tr Reconstruction (4)
Introduction to DaVincimdash November 2004 Software week ndash p 785
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Structure (a bit old)
Introduction to DaVincimdash November 2004 Software week ndash p 885
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Physics Packages (v12r3)Basic components
PhysDaVinci Main
PhysDaVinciKernel Base classes
PhysDaVinciFilter Particle filters
PhysParticleMaker Particle makers
PhysVertexFit Vertex fitters
PhysDaVinciTransporter Transporters
PhysDaVinciTools Anything else
ToolsUtilities Simple utilities
Physics analysis
PhysPhysSelections Genericselection algorithms
PhysKs2PiPiSel K0
Srarr ππ
PhysCommonParticles π0
PhysFlavourTagging Flavour tagging
ToolsLoKi LoKi see dedicated lesson
ToolsStripping Stripping tools
MC-truth and test packages
PhysDaVinciMCTools MC Tools
PhysDaVinciAssociators Associators to MC truth
PhysDaVinciEff Efficiency algorithms
PhysDaVinciTest Tests
PhysDaVinciUser Template user package
Introduction to DaVincimdash November 2004 Software week ndash p 985
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
First trybull Get it
bull Compile it
bull Run it
bull Particles and ProtoParticles
This part is almost hands-on Justfollow the instructions on your useraccount after the lesson
Introduction to DaVincimdash November 2004 Software week ndash p 1085
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This sets the path where cmt will find all neces-sary packagesgt echo $CMTPATHafscernchuserppkoppenbcmtuserafscernchlhcbsoft
warereleasesDAVINCIDAVINCI_v12r3afscernchlhcbsoft
warereleasesLHCBLHCB_v16r3afscernchlhcbsoftware
releasesDBASEafscernchlhcbsoftwarereleasesPARAM
afscernchswGaudireleasesGAUDIGAUDI_v15r3afscern
chswlcgappreleasesLCGCMTLCGCMT_26_2d
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
The DaVinci ldquoprojectrdquo contains presently 75 pack-ages The PhysDaVinci main package is justone of it
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
This will set one environment variable for each ofthe packages neededgt echo $DAVINCIROOTafscernchuserppkoppenbcmtuserPhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
First trybull Set the version of DaVinci you want to use (always)gt DaVinciEnv v12r3
bull go to your working directorygt cd $HOMEcmtuser
bull Get the DaVinci package (once)gt getpack PhysDaVinci v12r3
bull Setup your environment (always)gt cd PhysDaVinciv12r3cmtgt source setupcsh
bull Make the executable (once)gt make
bull Execute DaVinci (whenever needed)gt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1185
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Even simplerbull Set the version of DaVinci you want to usegt DaVinciEnv v12r3
bull Setup your environmentgt source $DaVinci_release_areaDAVINCIDAVINCI_v12r3PhysDaVinciv12r3cmtsetupcsh
bull Execute DaVincigt DaVinci
What did it do
Actually not much
DaVinci is an alias forgt which DaVinciDaVinci aliased to afscernchuserppkoppenbcmtuser-
PhysDaVinciv12r3rh73_gcc323DaVinciexe
When DaVinci is run with no options it loads itrsquosconfiguration from optionsDaVinciopts
Introduction to DaVincimdash November 2004 Software week ndash p 1285
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
DaVinciopts
DaVinciopts is a dummy option file Removing theirrelevant stuff there isinclude $DAVINCIROOToptionsDaVinciCommonoptsinclude $DAVINCIROOToptionsDaVinciRecooptsinclude $DAVINCIROOToptionsDaVinciTestDataoptsApplicationMgrEvtMax = 1000
bull DaVinciCommonopts is where all default settings andpackages are defined Donrsquot touch
bull DaVinciRecoopts makes the ProtoParticles andthe primary vertex
bull DaVinciTestDataopts provides some BB DST
Introduction to DaVincimdash November 2004 Software week ndash p 1385
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
ProtoParticlesProtoParticles
bull are the end of the reconstruction stagebull are the starting point of the physics analysisbull have all the links about how they have been
reconstructedbull Trackbull Calo cluster
bull have a list of PID hypothesis with a probabilitybull contain the kinematic information
You need to assign them a mass anda PID to get the full 4-vector
rArr Particles
Introduction to DaVincimdash November 2004 Software week ndash p 1485
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Particlesbull Particle = ProtoParticle + one PID choice
rarr one defined massbull Physics analyses deal with Particles
bull You need to know the 4-vectors to compute the massof a resonance
bull The PID is your choicebull The same ProtoParticle can be made as a π and
as a K bull Some ProtoParticles can be ignoredbull All this is done by configuring the ParticleMaker
(described later)
Introduction to DaVincimdash November 2004 Software week ndash p 1585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Select Bs rarr Jψ φ
bull Design it
bull Make particles
bull Make Jψrsquos
bull Some histograms
bull Add the φ
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 1685
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Reminder Algorithms
Algorithms are objects executed at each eventThe primary vertex for instance is made by an algorithmdeclared in DaVinciRecoopts by
ApplicationMgrTopAlg += PrimVtxFinder
What DaVinci does is defined by the algorithms that arecalled In Gaudi-jargon an algorithm is a class inheriting fromAlgorithm which containsbull an initialize() method called at begin of runbull an execute() method called at each eventbull a finalize() method called at end of run
To make life easier DaVinci contains a base-classDVAlgorithm that provides many useful features
Introduction to DaVincimdash November 2004 Software week ndash p 1785
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Recent changesbull DVAlgorithm now inherits from the new base-classGaudiTupleAlg
bull That inherits from GaudiHistoAlgbull That inherits from GaudiAlgorithm
rarr There are many new shortcuts available
debug() ltlt Hello world ltlt endmsg plot(twoMum()DiMu mass2GeV4GeV)IDebugTool m_debug =
toolltIDebugToolgt( DebugTool )
They succeed to much longer syntaxes that everyone had touse one year ago
Introduction to DaVincimdash November 2004 Software week ndash p 1885
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Design it
One could write asingle algorithm thatmakes particles com-bines micro into Jψ andK into φ and thenmakes the Bs
This is not a good idea
It is much better towrite a simple algo-rithm for each task andto save the intermedi-ate data in the tran-sient event store (TES)
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Design it
Algorithms TES
MakeParticles
Make Jψ
Make φ
Make Bs
Proto-Particles
ChargedParticles
Jψ
φ
Bs
bull Algorithms have asmany inputs asneeded but onlyone output
bull TES locations canbe read by any algo-rithm but only onecan write to them
Letrsquos start to write thechain
Introduction to DaVincimdash November 2004 Software week ndash p 1985
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Locations in the TES
The output of an algorithm called MyAlgo is saved inbull EventPhysMyAlgoParticles andbull EventPhysMyAlgoVertices
Algorithm instance names have to be unique rarr particles willbe stored in different locations
This becomes important if you want to test the correlation ofyour Bs rarr Jψφ selection with the TDR selection of B rarr
JψK0S or test the efficiency of the HLT Jψ selection
Make sure all algorithm names are uniqueIt is mandatory for the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 2085
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Get the Tutorial package
Get the latest version of the TutorialAnalysis packagegt cd $HOMEcmtusergt getpack TutorialAnalysis v4gt cmt configgt cmt br makegt source setupcshgt echo $ANALYSISROOT
afscernchcmtuserTutorialAnalysisv4gt echo $DAVINCIROOT
afscernchcmtuserPhysDaVinciv12r3
Or if you donrsquot have DaVinci in your areaafscernchlhcbsoftwarereleasesDAVINCIDAVINCI_v12r3PhysDaVinciv12r3
Introduction to DaVincimdash November 2004 Software week ndash p 2185
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to do
cd $ANALYSISROOTOpen a file emacs optionsDVTutorialopts
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
Input the common initialisation
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
Donrsquot forget the DLL of the package you just added toDaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
Include the reconstruction of ProtoParticles andprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
Letrsquos start the Bs rarr Jψφ sequence
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
Use the default algorithm to make particlesWersquoll have a closer look later on
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
This one wersquoll have to write
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Start to write the options
Itrsquos a good idea to start with the options This gives the list ofthings to doinclude $DAVINCIROOToptionsDaVinciCommonopts
ApplicationMgrDLLs += Analysis
include $DAVINCIROOToptionsDaVinciRecoopts
ApplicationMgrTopAlg += GaudiSequencerTutorial
TutorialMembers += PreLoadParticles
include $PARTICLEMAKERROOToptionsPreLoadParticlesopts
TutorialMembers += TutorialAlgorithm
EventSelectorInput =
DATAFILE=rsquoPFNrfiocastorcernchlhcbDC0400000543_00000017_5dstrsquo
TYP=rsquoPOOL_ROOTTREErsquo OPT=rsquoREADrsquo
Add some data to read You get it from theBookkeeping
Introduction to DaVincimdash November 2004 Software week ndash p 2285
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Letrsquos write the algorithm
In $ANALYSISROOT typegt emacs srcTutorialAlgorithmcpphEmacs will ask you what you want to create Answer (D) forDVAlgorithm (twice) and you will get a template for a newalgorithm that compiles nicely but does nothing at all
Before you forget it add the following line tosrcAnalysis_loadcppDECLARE_ALGORITHM(TutorialAlgorithm)
Now go to cmt and recompile the package
Introduction to DaVincimdash November 2004 Software week ndash p 2385
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
A look at the header fileinclude DaVinciToolsDVAlgorithmh
class TutorialAlgorithm public DVAlgorithm
public
Standard constructor
TutorialAlgorithm( const stdstringamp name ISvcLocator pSvcLocator )
virtual ˜TutorialAlgorithm() lt Destructor
virtual StatusCode initialize() lt Algorithm initialization
virtual StatusCode execute () lt Algorithm execution
virtual StatusCode finalize () lt Algorithm finalization
protected
private
bull It inherits from DVAlgorithm which provides the most frequently usedtasks in a convenient way
bull The constructor allows to initialise global variables (mandatory) and todeclare options
bull The three methods initialize() execute() finalize() controlyour algorithm Feel free to add more
Introduction to DaVincimdash November 2004 Software week ndash p 2485
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Edit the header file
Cuts should be defined by options we hence need them tobe data members of the algorithm InTutorialAlgorithmhprivate
double m_JPsiMassWin lt Mass windowdouble m_JPsiChi2 lt Max Jpsi chiˆ2
We will also need the Jψ PID its mass and some statistics
int m_JPsiID lt Jpsi IDdouble m_JPsiMass lt Jpsi massint m_nJPsis lt number of Jpsisint m_nEvents lt number of Events
Introduction to DaVincimdash November 2004 Software week ndash p 2585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Constructor
All data members have to be initialised in the constructorTutorialAlgorithmTutorialAlgorithm(
const stdstringamp name ISvcLocator pSvcLocator)
DVAlgorithm ( name pSvcLocator )
m_JPsiID(0)
m_JPsiMass(0)
m_nJPsis(0)
m_nEvents(0)
declareProperty(MassWindow m_JPsiMassWin = 10GeV)
declareProperty(MaxChi2 m_JPsiChi2 = 1000)
bull Options have to be defined with declareProperty
bull All others can be initialised to a dummy valuebull You can just ignore the destructor
Introduction to DaVincimdash November 2004 Software week ndash p 2685
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull To initialise the Jψ mass and PID you first need to findthe particle properties of the Jψ
bull DVAlgorithm provides a pointer to the ParticleProperty Service ppSvc()
bull The name of the Jψ can be found in$PARAMFILESROOTdataParticleTabletxt
Introduction to DaVincimdash November 2004 Software week ndash p 2785
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Initialisationdebug() ltlt ==gt Initialize ltlt endmsg
ParticleProperty m_psi = ppSvc()-gtfind( Jpsi(1S) )
m_JPsiID = m_psi-gtpdgID()
m_JPsiMass = m_psi-gtmass()
info() ltlt Will reconstruct ltlt m_psi-gtparticle() ltlt (ID=
ltlt m_JPsiID ltlt ) with mass ltlt m_JPsiMass ltlt endreq
info() ltlt Mass window is ltlt m_JPsiMassWin ltlt MeV ltlt endreq
info() ltlt Max chiˆ2 is ltlt m_JPsiChi2 ltlt endreq
bull From the IParticlePropertySvc class one can see inDoxyGen that there is a methodParticleProperty find (const stdstring ampname)
bull Then in ParticleProperty one locatesdouble mass() constint pdgID() const
Introduction to DaVincimdash November 2004 Software week ndash p 2885
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
DVAlgorithm base-class
A look at the DoxyGen web page shows that DVAlgorithmprovides a lot of functionality (not all listed here)
IPhysDesktop desktop() constIMassVertexFitter massVertexFitter() constIVertexFitter vertexFitter() constIGeomDispCalculator geomDispCalculator() constIParticleFilter particleFilter() constIParticlePropertySvc ppSvc() constStatusCode setFilterPassed (bool)stdstring getDecayDescriptor()
We will use some of them
Introduction to DaVincimdash November 2004 Software week ndash p 2985
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Execute
1 Take the particles from the TES location where theparticle maker algorithm has put them
2 Keep only the ones we need ie muons
3 Combine them to Jψrsquos and fit the vertex
4 Apply some cuts
5 Save the selected Jψrsquos to the TES
6 We probably also would like to fill some histograms
For most of these tasks we have Tools
Introduction to DaVincimdash November 2004 Software week ndash p 3085
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Zoology of DaVinci tools
A Tool is a light weight object whose purpose is to help othercomponents to perform their workbull The particle filter and filter criteria are very useful tools
They allow to apply cuts steered by optionsbull Vertexing tools UnconstVertexFitterLagrangeMassVertexFitterLagrangeGeomVertexFitter
bull Geometrical toolbull Particle transportersbull Associatorsbull
Introduction to DaVincimdash November 2004 Software week ndash p 3185
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
The PhysDesktop
The PhysDesktop is a tool that controls the loading andsaving of the particles that are currently usedbull It collects previously maked particlesbull It produces particles and saves them to the TES when
needed
rarr It hides the interaction with the TES
To get the particles and vertices just dobull const ParticleVectoramp parts =desktop()-gtparticles()
bull const VertexVectoramp parts =desktop()-gtvertices()
Introduction to DaVincimdash November 2004 Software week ndash p 3285
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Get the particles get particles Filter muons
const ParticleVectoramp parts = desktop()-gtparticles()
ParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
if (sc)
err() ltlt Error while filtering ltlt endreq
return sc
verbose() ltlt Filtered ltlt MuMinussize() ltlt mu- and
ltlt MuPlussize() ltlt mu+ ltlt endreq
bull We get the particles from the PhysDesktop tool
bull Then we fill them into ParticleVector of microminus and micro+
using the methods of the ParticleFilter (seeDoxyGen)
bull Wersquoll ensure they are actually muons later on
Introduction to DaVincimdash November 2004 Software week ndash p 3385
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Combine the muons combine mu+ and mu-
ParticleVectorconst_iterator imup imum
for ( imum = MuMinusbegin() imum = MuMinusend() ++imum )
for ( imup = MuPlusbegin() imup = MuPlusend() ++imup )
HepLorentzVector twoMu = (imup)-gtmomentum() + (imum)-gtmomentum()
verbose() ltlt Two muon mass is ltlt twoMum()MeV ltlt endreq
if ( fabs ( twoMum() - m_JPsiMass ) gt m_JPsiMassWin ) continue
bull Have a look at the Particle class DoxyGenbull ParticleVector is a typedefstdvectorltParticlegt
rarr Hence the non-intuitive (imup)-gtmomentum() syntax
Introduction to DaVincimdash November 2004 Software week ndash p 3485
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Vertex fit
Insert vertex fit
Vertex MuMuVertex
sc = vertexFitter()-gtfitVertex((imup)(imum)MuMuVertex)
if (sc)
info() ltlt Failed to fit vertex ltlt endreq no big deal
continue
debug() ltlt Vertex fit at ltlt MuMuVertexposition()cm
ltlt with chi2 ltlt MuMuVertexchi2() ltlt endreq
chi2 cut
if ( MuMuVertexchi2() gt m_JPsiChi2 ) continue
bull The vertexFitter() method returns a pointer to theunconstrained vertex fitter UnconstVertexFitter
Introduction to DaVincimdash November 2004 Software week ndash p 3585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Create the candidateParticle Jpsi
sc = particleStuffer()-gtfillParticle(MuMuVertexJpsi
ParticleID(m_JPsiID))
Particle pJpsi = desktop()-gtcreateParticle(ampJpsi)
info() ltlt Created Jpsi candidate with m= ltlt Jpsimass()
ltlt and chiˆ2= ltlt MuMuVertexchi2() ltlt endreq
if (pJpsi)
err() ltlt Cannot save particle to desktop ltlt endreq
return StatusCodeFAILURE
else setFilterPassed(true)
bull The ParticleStuffer tool makes particles fromvertices It is your job to provide the particle ID
bull Then save the new created particle to the PhysDesktop
bull setFilterPassed(true) tells the algorithm that it hasfound what it is looking for
Introduction to DaVincimdash November 2004 Software week ndash p 3685
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Save the new particles
At the end put
sc = desktop()-gtsaveDesktop()return sc
This will save all new particles in the desktop
The PhysDesktop has also methods to save a given list ofparticlesParticleVector myPsis sc = desktop()-gtsaveTrees( myPsis )sc = desktop()-gtsaveTrees( m_JPsiID )
bull All particles and vertices will be saved toEventPhysJpsi2MuMuParticles andEventPhysJpsi2MuMuVertices
Introduction to DaVincimdash November 2004 Software week ndash p 3785
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Particles and Vertices
The Particle and Vertex classes depend on each other
Vertex Particleendvertex() SmartRefVectorltParticlegt amp Vertexproducts()
To navigate from a particle to its daughters doSmartRefVectorltParticlegt themus= JpsiendVertex()-gtproducts()
and use themus as any stdvector of pointers
Note There is no direct link between Particles
Introduction to DaVincimdash November 2004 Software week ndash p 3885
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Finalize
If you have incremented the counters m_nEvents andm_nJpsis you can print them at the end of the job
StatusCode TutorialAlgorithmfinalize()
debug() ltlt ==gt Finalize ltlt endmsginfo() ltlt Found ltlt m_nJPsis ltlt Jpsi in
ltlt m_nEvents ltlt events ltlt endreqreturn StatusCodeSUCCESS
Note Unlike in GaudiAlgorithm donrsquotreturn GaudiAlgorithmfinalize() or similarThis is done in the sysFinalize() method ofDVAlgorithm
Introduction to DaVincimdash November 2004 Software week ndash p 3985
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
End of C++ partbull We now have a complete
algorithmbull The execute() method
still fits on a single pagebut becomes a littlelongish to my taste
bull If yoursquod like to split it insmaller methods yoursquorewelcome
bull You can now compile itbull The next step is to com-
plete the options
Introduction to DaVincimdash November 2004 Software week ndash p 4085
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
OptionsTutorialMembers += PreLoadParticles
[]
TutorialMembers += TutorialAlgorithmJpsi2MuMu
Jpsi2MuMuPhysDesktopInputLocations = PhysPreLoadParticles
Jpsi2MuMuMassWindow = 50MeV
Jpsi2MuMuMaxChi2 = 100
Jpsi2MuMuOutputLevel = 3
bull We already have the PreLoadParticles andTutorialAlgorithm algorithms in the Tutorialsequence Letrsquos call it Jpsi2MuMu
bull Configure the cuts and the verbosity levelbull Tell the PhysDesktop from where to take the particlesbull It automatically adds Event to the location if
necessary
Introduction to DaVincimdash November 2004 Software week ndash p 4185
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Particle Filtering
Remember the particle filtering codeParticleVector MuPlus MuMinus
StatusCode sc = particleFilter()-gtfilterNegative(partsMuMinus)
if (sc) sc = particleFilter()-gtfilterPositive(partsMuPlus)
We want to make sure that only muons will be usedJpsi2MuMuParticleFilterCriteriaNames = PIDFilterCriterionMuons
Jpsi2MuMuParticleFilterMuonsParticleNames = mu+ mu-
bull The ParticleFilter tool accepts a list of filter criteriabull In this case we just want to filter according to PID
rarr PIDFilterCriterion
bull Simply tell it what particles you need
Introduction to DaVincimdash November 2004 Software week ndash p 4285
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Particle Filtering
TheParticleFilteris a very powerfultool that acceptsmany filter crite-ria all based onthe same interfaceIFilterCriterion
In the DoxyGendocumentationyou have the fulllist of criteria
bull FlightDistanceFilterCriterion
bull KinFilterCriterion P PTbull LifetimeSignificanceFilterCriterion
bull Mass(Difference)FilterCriterion m∆m
bull Momentum2FlightAngleFilterCriterion
bull PIDFilterCriterion
bull PVIPFilterCriterion IP on primaryvertices
bull TrackTypeFilterCriterion
bull TrueMCFilterCriterion require tracksfrom a given decay
bull VtxFilterCriterion cut on the trackrsquosdecay vertex
bull BooleanFilterCriterion allows to com-bine filter criteria
Introduction to DaVincimdash November 2004 Software week ndash p 4385
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Run it
gt DaVinci optionsDVTutorial_1opts | tee out
In file out we find what we did at initializationJpsi2MuMu INFO Will reconstruct Jpsi(1S) (ID=443) with mass 309687
Jpsi2MuMu INFO Mass window is 50 MeV
Jpsi2MuMu INFO Max chiˆ2 is 100
In execute()Jpsi2MuMu INFO Created Jpsi candidate with m=31042 and chiˆ2=0166344
Jpsi2MuMu INFO Created Jpsi candidate with m=308936 and chiˆ2=05617
In finalize()Jpsi2MuMu SUCCESS Passed 176 times in 500 calls -gt (352+-213587) rejection= 284091+-0172381
Jpsi2MuMu INFO Found 176 Jpsi in 500 events
The first line above is printed by DVAlgorithm based on thenumber of times execute() issued asetFilterPassed(true) or false
Introduction to DaVincimdash November 2004 Software week ndash p 4485
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Letrsquos add histograms
Since DVAlgorithm inherits from GaudiHistoAlg youcan use the ldquoon-demandrdquo histogram booking service
Add the following histogram at a convenient place
plot(twoMum()DiMu mass2GeV4GeV)
And add a persistency in the optionsApplicationMgrHistogramPersistency = HBOOK
HistogramPersistencySvcOutputFile = DVHistoshbook
Jpsi2MuMuHistoProduce = true default anyway
Feel free to use ROOT as persistency if you prefer Hbook isprobably going to dissappear someday
Introduction to DaVincimdash November 2004 Software week ndash p 4585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Histograms
Dimuon mass [MeV]
1
10
10 2
10 3
2000 2200 2400 2600 2800 3000 3200 3400 3600 3800 4000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Histograms
All
Selected
Muon PT [MeV]
1
10
10 2
0 2000 4000 6000 8000 10000
bull Herersquos the nice Jψpeak you get
bull Exercise 1 Youcould add twohistograms of themicrorsquos PT one beforethe Jψ cuts andone after
bull Exercise 2 Thatcould encourageyou to add a PT cutto your micro selectionYou can do this byoptions only
Introduction to DaVincimdash November 2004 Software week ndash p 4685
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
What we have learned so farbull To configure a simple DaVinci jobbull To write a simple DVAlgorithm
bull To get and save data using the PhysDesktop
bull To use tools to perform the common tasksbull To navigate in DoxyGen to find the class definitions
One more exercise Adapt the TutorialAlgorithm so thatone can re-use this algorithm to also reconstruct φ rarr KKTutorialMembers += TutorialAlgorithmJpsi2MuMu
[]
TutorialMembers += TutorialAlgorithmPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKParticleFilterCriteriaNames = PIDFilterCriterionKaons
Phi2KKParticleFilterKaonsParticleNames = K+ K-
Introduction to DaVincimdash November 2004 Software week ndash p 4785
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Use and configurestandard algorithms
bull More about theParticleMaker
bull Make the φ using common tools
bull CombineParticles
bull RefineSelection
bull Common particles
bull The SelResult object
This part is based on theTutorialAnalysis packageAll can be found there
Introduction to DaVincimdash November 2004 Software week ndash p 4885
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
The ParticleMaker tools
The IParticleMaker interface (DoxyGen) is the base ofseveral particle maker tools They all make Particlesstarting from ProtoParticles
CombinedParticleMaker makes particles from chargedProtoParticles
NoPIDsParticleMaker make particles ignoring PID
PhotonFromMergedParticleMaker makes γ frommerged π0
(Cnv)PhotonParticleMaker make γ
ParticleMakerSeq allow a sequence of particle makers
MCParticleMaker makes particles from MC truthMCParticles
Introduction to DaVincimdash November 2004 Software week ndash p 4985
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
PreLoadParticles
A ParticleMaker can be declared to the PhysDesktop
One could have defined a ParticleMaker to Jpsi2MuMubut itrsquos more transparent to use PreLoadParticles
The options are
TutorialMembers += PreLoadParticles PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticles is a DVAlgorithm with oneParticleMaker defined that only saves the createdparticles
Introduction to DaVincimdash November 2004 Software week ndash p 5085
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
bull Kaons for instance are made using the RICH with cuts
DLL(K minus π) = lnL(K) minus lnL(π) = lnL(K)
L(π)
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
The CombinedParticleMaker
The CombinedParticleMaker makes Particles fromcharged ProtoParticles combining the PID informationof all detectors It is documented from the DaVinci page
The (main) options and default values areParticles = muon electron kaon proton pion
MuonSelection = det=rsquoMUONrsquo mu-pi=rsquo-80rsquo
ElectronSelection = det=rsquoCALOrsquo e-pi=rsquo00rsquo
KaonSelection = det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
ProtonSelection = det=rsquoRICHrsquo p-pi=rsquo30rsquo
PionSelection =
ExclusiveSelection = true
bull ExclusiveSelection means that only one Particleis made for each ProtoParticle in the order ofpreference given in Particles This is a verydangerous option
Introduction to DaVincimdash November 2004 Software week ndash p 5185
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Back to our example options
We should have defined the cut on the muons in the particlemaker rather than in the particle filter
To make only muons and kaons
TutorialMembers += PreLoadParticles
PreLoadParticlesPhysDesktopParticleMakerType =
CombinedParticleMaker
PreLoadParticlesPhysDesktopCombinedParticleMakerParticles =
muon kaon
PreLoadParticlesPhysDesktopCombinedParticleMakerKaonSelection =
det=rsquoRICHrsquo k-pi=rsquo20rsquo k-p=rsquo-20rsquo
PreLoadParticlesPhysDesktopCombinedParticleMakerMuonSelection =
det=rsquoMUONrsquo mu-pi=rsquo-100rsquo looser
PreLoadParticlesPhysDesktopCombinedParticleMakerExclusiveSelection
= false
This is bad practice Here PreLoadParticles has apotentially conflicting name
Introduction to DaVincimdash November 2004 Software week ndash p 5285
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Build the φ
To make the φ one can re-use the TutorialAlgorithm asin the suggested exercise
Or one can use the generic CombineParticles algorithmbull This algorithm reconstructs any (one-level) decay
according to what is defined in the decay descriptorbull It requires one FilterCriterion per input or output
particlebull Itrsquos actually written using LoKi
Yoursquod better learn to use this algorithm it might becomemandatory for the next stripping
Introduction to DaVincimdash November 2004 Software week ndash p 5385
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Build the φApplicationMgrDLLs += PhysSelections LoKi
TutorialMembers += CombineParticlesPhi2KK
Phi2KKPhysDesktopInputLocations = PhysPreLoadParticles
Phi2KKDecayDescriptor = phi(1020) -gt K+ K-
Phi2KKSelections = K+ PVIPFilterCriterion
K- PVIPFilterCriterion
phi(1020) BooleanFilterCriterionPhiFilter
Phi2KKPVIPFilterCriterionMinIPsignif = 2
Phi2KKPhiFilterAndList = MassFilterCriterion
VtxFilterCriterion
Phi2KKPhiFilterMassFilterCriterionWindow = 20MeV
Phi2KKPhiFilterVtxFilterCriterionMaxChi2 = 100
bull This selects φ in a mass window of 20 MeV and with aχ2 gt 100
bull made from kaons with a IPσIP gt 2 on all reconstructedprimary vertices
Introduction to DaVincimdash November 2004 Software week ndash p 5485
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Syntax of CombineParticles
DecayDescriptor Mandatorybull Only simple decay descriptors understoodbull Add []cc if you want both combinations
Selections vector of strings of the typeparticle CriterionName bull Use the BooleanFilterCriterion with no options
when you donrsquot want to filter anythingbull All particles in the descriptor must be declaredbull Charge-conjugates are never implicit
CombineParticlesDecayDescriptor = [rho(770)+ -gt pi0 pi+]cc
CombineParticlesSelections = rho(770)0 MassFilterCriterion
pi+ PVIPFilterCriterion
pi- PVIPFilterCriterion
pi0 MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 5585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Build the Bs
TutorialMembers += CombineParticlesBs2JpsiPhi
Bs2JpsiPhiPhysDesktopInputLocations = PhysPhi2KK
PhysJpsi2MuMu
Bs2JpsiPhiDecayDescriptor = B_s0 -gt phi(1020) Jpsi(1S)
Bs2JpsiPhiSelections = B_s0 BooleanFilterCriterionBFilter
Jpsi(1S) BooleanFilterCriterion
phi(1020) BooleanFilterCriterion
Bs2JpsiPhiBFilterAndList = MassFilterCriterion
VtxFilterCriterion
PVIPFilterCriterion
Bs2JpsiPhiBFilterMassFilterCriterionWindow = 50MeV
Bs2JpsiPhiBFilterVtxFilterCriterionMaxChi2 = 100
Bs2JpsiPhiBFilterPVIPFilterCriterionMaxIPsignif = 5
Bs2JpsiPhiBFilterPVIPFilterCriterionCutBestPV = true
bull This selects Bs in a mass window of 50 MeV a χ2 gt 100and IPσIP lt 5 wrt the vertex it points to
Introduction to DaVincimdash November 2004 Software week ndash p 5685
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
The end
Thatrsquos the end of the selection
We now have the full chain selecting Bs rarr Jψφ
Wersquoll come back to it later when we discuss MC truth andefficiencies
Introduction to DaVincimdash November 2004 Software week ndash p 5785
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
RefineSelection
RefineSelection allows to filter particles from a givenlocation in the TES
Options
ParticleNames Vector of particle namesbull CC not implicit (to be changed )bull Non listed particles are not filtered ie accepted
FilterNames Vector of ParticleFilter namesbull Note that these are ParticleFilter tools notFilterCriterion
bull Giving a dummy filter allows to merge several TESlocations to one (this is done in the stripping but notvery useful now that CheckSelResult exists)
bull Accepted Particles are clonedIntroduction to DaVincimdash November 2004 Software week ndash p 5885
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
RefineSelection exampleApplicationMgrDLLs += PhysSelections
ApplicationMgrTopAlg += RefineSelection
RefineSelectionPhysDesktopInputLocation = PhysPreLoadParticles
RefineSelectionParticleNames = mu+ mu- K+ K- no cc
RefineSelectionFilterNames = MuF MuF KF KF
RefineSelectionMuFCriteriaNames = KinFilterCriterion
RefineSelectionMuFKinFilterCriterionMinPt = 300
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinPt = 500
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 50
This selects micro with PT gt 300 MeV and K withPT gt 500 MeV and IPσIP gt 5
If there are pions in PhysPreLoadParticles theywill all pass But therersquos a solution
Introduction to DaVincimdash November 2004 Software week ndash p 5985
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Cut on daughters
One very nice feature of RefineSelection is that it allowsto filter particles by cutting on its daughtersHLTselBs2PhiPhiMembers += RefineSelection
RefineSelectionPhysDesktopInputLocations = PhysHLTPhi Phis
RefineSelectionParticleNames = phi(1020) K+ K-
RefineSelectionFilterNames = PhiF KF KF
RefineSelectionKFCriteriaNames = KinFilterCriterion
PVIPFilterCriterion
RefineSelectionKFKinFilterCriterionMinMomentum = 1000 hlt tuned
RefineSelectionKFPVIPFilterCriterionMinIPsignif = 1 hlt tuned
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 24MeV hlt tuned
There are actually no K in PhysHLTPhi The input areφ the output are φ but one cuts on the momentum of theK
Introduction to DaVincimdash November 2004 Software week ndash p 6085
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
CombineParticles versus RefineSelection
Donrsquot get confused by the different syntaxbull RefineSelection 1 ParticleFilter particlebull CombineParticles 1 FilterCriterion particle
CombineParticlesSelections = phi(1020) BooleanFilterCriterionPhiF
CombineParticlesPhiFAndList = MassFilterCriterion
VtxFilterCriterion
CombineParticlesPhiFMassFilterCriterionWindow = 20MeV
CombineParticlesPhiFVtxFilterCriterionMaxChi2 = 100
ButRefineSelectionParticles = phi(1020)
RefineSelectionFilterNames = PhiFilter
RefineSelectionPhiFilterCriteriaNames = MassFilterCriterion
VtxFilterCriterion
RefineSelectionPhiFilterMassFilterCriterionWindow = 20MeV
RefineSelectionPhiFilterVtxFilterCriterionMaxChi2 = 100
Introduction to DaVincimdash November 2004 Software week ndash p 6185
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
PIDFilter
PIDFilter selects (or rejects) particles of a given PID
Options
ParticleNames Names of particles
Reject = false Keep them or reject themApplicationMgrTopAlg += SequencerSeqPreselMuon
SeqPreselMuonMembers =
PreLoadParticlesCombined
PIDFilterFilterMuon
RefineSelectionPreselMuon
FilterMuonPhysDesktopInputLocations = PhysCombined
FilterMuonParticleNames = mu+ mu-
FilterMuonReject = false default
FilterMuon just filters micro from the defaultPreLoadParticles which is useful in the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 6285
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Listing continuedPreselMuonPhysDesktopInputLocations = PhysFilterMuon
PreselMuonParticleNames = mu+ mu-
PreselMuonFilterNames = MuFilter MuFilter
PreselMuonMuFilterCriteriaNames = KinFilterCriterion
PreselMuonMuFilterKinFilterCriterionMinPt = 3000 MeV from Hans
PreselMuonMuFilterKinFilterCriterionMinMomentum = 5000 MeV from BTagging
PreselMuonMuFilterCriteriaNames += TrackTypeFilterCriterion
PreselMuonMuFilterTrackTypeFilterCriterionRequireLong = true does nothing
PreselMuonMuFilterCriteriaNames += PVIPFilterCriterion
PreselMuonMuFilterPVIPFilterCriterionMinIPsignif = 50 from Hans
This is the whole preselection for the ldquogood muonrdquo stream wehave added to the strippingIt starts from the standard particle maker selects muons andapplies some cuts 0 line of C++
Introduction to DaVincimdash November 2004 Software week ndash p 6385
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Common particles
Some particles are already made for you with optionsconfigured by the experts
π0 are made by the package PhysCommonParticles
ApplicationMgrDLLs += CommonParticles
ApplicationMgrTopAlg += ResolvedPi0Alg
include $COMMONPARTICLESROOToptionsResolvedPi0Algopts
ApplicationMgrTopAlg += MergedPi0Alg
include $COMMONPARTICLESROOToptionsMergedPi0Algopts
K0S are made by the package PhysKs2PiPiSel
include $KS2PIPISELROOToptionsKs2PiPiSelopts
For tight K0S
include $KS2PIPISELROOToptionsbestKs2PiPiSelopts
Jψ can be found PhysSelJpsi
More to comeIntroduction to DaVincimdash November 2004 Software week ndash p 6485
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
SelResult
Each DVAlgorithm writes out a SelResult objectcontainingbull the result of the FilterPassed outputbull the decay descriptorbull the output location of the algorithm
All this is written to the TES inSelResultLocationDefault
You can read the result of any algorithm from any algorithmor tool You need
include EventSelResulth
Introduction to DaVincimdash November 2004 Software week ndash p 6585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
The SelResult object
Some algorithms read out the SelResult objectbull CheckSelResult reads the SelResult of a given list
of algorithms and allows to perform an and and or ofthese results Useful if you want a sequencer to dependon an algorithm executed in another sequence
bull SelResultCorrelations prints a correlation table ofefficiencies of various algorithms
Algorithm Eff 1 2 3 4 5
----------------------------------------------------------------------
1 AllBd2JpsiKsTracks 8682 | 9826 9916 8682 9332
2 HLTAllJpsis 8747 | 9899 10000 8747 9239
3 HLTHighIPJpsi 8263 | 9437 9447 8263 8818
4 TDRselBd2Jpsi2MuMu 10000 | 10000 10000 10000 10000
5 Bd2JpsiKsAndTDR 8968 | 9639 9473 9571 8968
Introduction to DaVincimdash November 2004 Software week ndash p 6685
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Ready-to-use option files
Every option file beginning with DV is complete and can beused instead of DaVinciopts There are 141 availableHere are a few
DAVINCIROOToptionsDVWriteMiniDstopts writesa mini-DST
DAVINCIROOToptionsDVReadMiniDstopts reads itback
DAVINCIROOToptionsDVTriggerFilteroptswrites out events that pass L0 and L1
PhysSeloptionsDVTDRselopts execute TDRselection
PhysSeloptionsDVPreselopts executepre-selection
Introduction to DaVincimdash November 2004 Software week ndash p 6785
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Some more Toolsbull Vertex Fitters
bull The Geometrical Tool
bull About the Primary Vertices
bull Reminder about Tools
Introduction to DaVincimdash November 2004 Software week ndash p 6885
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Vertex FittersUnconstVertexFitter IVertexFitter
Performs an unconstrained vertex fit
LagrangeMassVertexFitter IMassVertexFitterA kinematical constrained fit using Lagrange multipliersmethod with mass and geometrical constraint If aparticle has Γ gt 1 MeV its daughters are used in the fit
DVAlgorithm interfaces them with vertexFitter() andmassVertexFitter()
Particle JPsi
Vertex PsiVertex
ParticleVector TheMus =
StatusCode sc = vertexFitter()-gtfitVertex(TheMus PsiVertex)
sc = massVertexFitter()-gtfitWithMass (Jpsi(1S) TheMus
PsiVertex JPsi)
There are also methods with 2ndash4 particles as inputIntroduction to DaVincimdash November 2004 Software week ndash p 6985
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Geometrical Toolbull The GeomDispCalculator tool
(IGeomDispCalculator) is interfaced bygeomDispCalculator() in DVAlgorithm
rarr It allows to calculate distances between Particles andVertices
Particle Mu1 Mu2
Vertex PV JpsiVx
double ip dca v2v err
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(Mu1 PV ip err)
sc = geomDispCalculator()-gtcalcCloseAppr(Mu1 Mu2 dca err)
sc = geomDispCalculator()-gtcalcVertexDis( PV JpsiVx v2v err )
Introduction to DaVincimdash November 2004 Software week ndash p 7085
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Primary vertex
To get the primary verticesVertices PV = getltVerticesgt(VertexLocationPrimary))
for (iv=PV-gtbegin()iv=PV-gtend()++iv)
Vertex v = iv
double ip = -1 ipe = -1
StatusCode sc = geomDispCalculator()-gtcalcImpactPar(
part (iv) ip ipe)
Introduction to DaVincimdash November 2004 Software week ndash p 7185
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Reminder about Tools
All this assumes that you use these tools fromDVAlgorithm and that you need only one of each kindIf you use these tools from a simple GaudiAlgorithm orfrom a tool or you need more than one you will need todelare them yourself This is very easy now
include DaVinciToolsIGeomDispCalculator
include DaVinciToolsIFilterCriterion
IGeomDispCalculator m_geom =
toolltIGeomDispCalculatorgt(GeomDispCalculator)
stdstring m_myFCname = PVIPFilterCriterion
IFilterCriterion i_myFC =
toolltIFilterCriteriongt( m_myFCname this )
Here you could pass PVIPFilterCriterion as anoption
Introduction to DaVincimdash November 2004 Software week ndash p 7285
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Practical example
If you need several ParticleFilter tools in aDVAlgorithm you need to declare some yourself
declareProperty( ParticleFilter1
m_MuFilterName = MuFilter )
declareProperty( ParticleFilter2
m_JpsiFilterName = JPsiFilter )
IParticleFilter m_MuFilter = toolltIParticleFiltergt
(ParticleFilter m_MuFilterName this)
IParticleFilter m_JpsiFilter = toolltIParticleFiltergt
(ParticleFilter m_JPsiFilterName this)
The options
MyAlgParticleFilter1 = JPsiFilter
MyAlgParticleFilter2 = MuFilter
MyAlgMuFilterCriteriaNames = KinFilterCriterion
MyAlgJPsiFilterCriteriaNames = MassFilterCriterion
Introduction to DaVincimdash November 2004 Software week ndash p 7385
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Toolsbull Have a look at the new Gaudi basics tutorial about writing
toolsbull Very often a light-weight tool is the simple solution to a
complicated problembull Please use and write FilterCriterion toolsbull And let me know when you have a new one to be
released in DaVinci
Introduction to DaVincimdash November 2004 Software week ndash p 7485
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
MC truthbull Efficiency algorithms
bull DebugTool
bull Decay Finder
bull All this is based on theDaVinciAssociatorsrarr see Philippersquos talk
Introduction to DaVincimdash November 2004 Software week ndash p 7585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Efficiency algorithms
DaVinci contains two algorithms that allow to calculateselection efficiencies
MCEffBuilder efficiency
EffSelCheck selection efficiencies
As we will not be using these algorithms on background itrsquosrecommended to put the options in a separate file to be putafter the selection options
include $ANALYSISROOToptionsEfficiencyopts
Introduction to DaVincimdash November 2004 Software week ndash p 7685
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Reconstruction efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += MCEffBuilderEffMcTruth
EffMcTruthMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
bull It should not be in the Tutorial sequencer (or theefficiencies would all be 1 by construction)
bull MCEffBuilder needs to know the decay descriptor ofthe decay
bull Decay descriptors are described on the web Particleswith a ldquoˆrdquo are the ones to be reconstructed
bull But itrsquos easier to steal them from the EvtGen decay file in$LHCBRELEASESDBASEGenDecFilesv6r3dkfiles
Introduction to DaVincimdash November 2004 Software week ndash p 7785
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Reconstruction efficiency
Output from MCEffBuilder
Decay analyzed (MC truth) [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-) (Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
Events processed 500
Decay Of Interest Generated ( Events ) 497 0994
DoIs Gen Reconstructible (ALL) ( Generated ) 103 0207243
DoIs Gen Reconstructed (ALL) ( Generated ) 109 0219316
---------------------------------------------
DoIs Gen Recrsquoble amp Recrsquoted (ALL) 92
Rec efficiency (Recrsquotible amp Recrsquoted)Recrsquotible (ALL) 0893204 +- 00304323
bull A long track is ldquoreconstructiblerdquo if it has 3r 3φ in the Veloand 1x 1 stereo clusters in each of the seeding stations
bull A track can be reconstructed although it is notreconstructible
bull The full definitions are hereIntroduction to DaVincimdash November 2004 Software week ndash p 7885
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Selection efficiency
In $ANALYSISROOToptionsEfficiencyopts writeApplicationMgrTopAlg += EffSelCheckEffBs2JpsiPhi
EffBs2JpsiPhiHistograms = true
EffBs2JpsiPhiMCDecay = [B_s0 -gt (phi(1020) -gt ˆK+ ˆK-)
(Jpsi(1S) -gt ˆmu+ ˆmu- gamma)]cc
EffBs2JpsiPhiSelDecay = [B_s0 -gt (phi(1020) -gt K+ K-)
(Jpsi(1S) -gt mu+ mu-)]cc
bull The MC decay descriptor is the same as beforebull The selection decay is what we actually reconstruct
There are no ldquoˆrdquo neededbull EffSelCheck produces a histograms of m P PT z rzPV rPV decay distance and flight time for all initial andintermediate particles and for MC truth selected andassociated
Introduction to DaVincimdash November 2004 Software week ndash p 7985
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Selection efficiency Sub-tree head B_s0
Mass window for this sub-tree head 53696 +- 005 (GeVc2)
DoIs Selected ( Reconstructed ) 44 040367
DoIs Selected in Mass Window 44 040367
----------------------------------------------------------------------------------------
DoIs Sel Associated (CompORChi2) ( Selected ) 44 1
DoIs Sel Assoc (CompORChi2) in Mass Window 44 1
----------------------------------------------------------------------------------------
Efficiency (Sel and Assoc(OR))Reconstructed 040367 +- 00469941
Efficiency (Sel and Assoc(OR) and Mass)Reconstructed 040367 +- 00469941
Purity (Selected and Associated(OR))Selected 1 +- 0
bull Looking at the Bs we have 44 selectedbull all being associated to truthbull There are similar tables for Jψ
Introduction to DaVincimdash November 2004 Software week ndash p 8085
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
The DebugTool
bull The debug tool provides a human-readable dump of theevent
bull It works both with MC truth and with reconstructedparticles
bull It looks like this
lt------------------------------------------------- Particle -------------------------------------------------gt
Name E M P Px Py Pz Pt phi Vz
GeV GeV GeV GeV GeV GeV GeV mrad cm
B_s0 255062 8686 254915 -20824 -0062 254063 20824 -3138630 -0891
+--gtJpsi(1S) 202675 3127 202651 -19344 -1318 201721 19389 -3073579 0653
|+--gtmu+ 91705 0106 91705 -7480 -1478 91388 7624 -2946498 -1077
|+--gtmu- 110970 0106 110970 -11865 0160 110334 11866 3128083 -0684
+--gtphi(1020) 52387 1030 52377 -1479 1256 52341 1941 2437643 -0941
+--gtK- 21810 0494 21804 -0498 0523 21792 0723 2331488 -0806
+--gtK+ 30577 0494 30573 -0981 0733 30549 1225 2500202 -0839
Introduction to DaVincimdash November 2004 Software week ndash p 8185
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Debug algorithms
There are provided algorithms that call the debug tool
DumpEvent No options Dumps the whole MC eventPrintTree Prints the reconstructed tree
TutorialMembers += PrintTreePrintFoundBs
PrintFoundBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintFoundBsPhysDesktopInputLocations = PhysBs2JpsiPhi
PrintFoundBsOutputLevel = 3
PrintMCTree Prints the MC decay tree of particles of a givenIDTutorialMembers += PrintMCTreePrintTrueBs
PrintTrueBsDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
PrintTrueBParticleNames = B_s0 B_s˜0
PrintTrueBsOutputLevel = 3
PrintTrueBDepth = 2 down to the K and mu
Introduction to DaVincimdash November 2004 Software week ndash p 8285
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Using the debug tool
The DebugTool can be used directly from an algorithm forinstance to print only when something goes wrong It is notalready present in DVAlgorithm bull Declare it
include DaVinciMCToolsIDebugToolh
bull Use itIDebugTool m_debug = toolltIDebugToolgt( DebugTool )
m_debug-gtprintTree(part [ depth])
m_debug-gtprintAncestor(mcpart)
bull Configure itJpsi2MuMuDebugToolInformations = Name E M P Px Py Pz Pt phi Vz
Jpsi2MuMuDebugToolPrintDepth = 3
bull There are other methods and options Have a look atDoxyGen
Introduction to DaVincimdash November 2004 Software week ndash p 8385
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Decay Finderbull The decay finder allows to find any decay in the eventbull It works both on MC and reconstructed particlesbull It uses a decay descriptor string Look at the DOC
Practical exampleinclude DaVinciMCToolsI(MC)DecayFinderh
I(MC)DecayFinder m_finder = toolltI(MC)DecayFindergt((MC)DecayFinder)
const (MC)Particle result = NULL
while ( m_finder-gtfindDecay( (mc)partsresult() )
the decay has been found
m_debug-gtprintTree( result )
Or just test if a decay is herebool found = m_debug-gthasDecay( (mc)parts )
Introduction to DaVincimdash November 2004 Software week ndash p 8485
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585
P Koppenburg
Conclusion
bull During the last year DaVinci evolved from aframework for writing selection code in C++ to aset of algorithms and tools that allow to performmany tasks with very little private code
bull If you feel something is missing Please writesomething generic and add it to DaVinci
bull The evolution of DaVinci is now driven by the HLTbull Encourages the development of generic codebull Forces common components to handle both
on- and offline particlesbull Sets up a framework that can also be used for
the stripping
Introduction to DaVincimdash November 2004 Software week ndash p 8585