# Difference: DaVinciTutorial3 (1 vs. 15)

#### Revision 152013-09-30 - PatrickSKoppenburg

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Changed:
<
<
WARNING: These optiosn work, but are deprecated. One should now use the Selection Framework as in DaVinciTutorial4.
>
>
WARNING: These options work, but are deprecated. One should now use the Selection Framework as in DaVinciTutorial4.

Changed:
<
<
You could actually use the algorithm from DaVinciTutorial2 to make the Phi too. The procedure for selecting the Phi is the same, it's just the properties of the mother and the type of the daughters that change.
>
>
You could actually use the algorithm from DaVinciTutorial2 to make the φ(1020) too. The procedure for selecting the φ is the same, it's just the properties of the mother and the type of the daughters that change.

Changed:
<
<
Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like this:
>
>
Adapt `TutorialAlgorithm` in order to be able to select J/ψ and φ depending on the configuration. The options should look like this:
%SYNTAX{ syntax="python"}%from Gaudi.Configuration import * ####################################################################### #
Line: 21 to 21
# from Configurables import TutorialAlgorithm jpsi2mumu = TutorialAlgorithm("Jpsi2MuMu")
Changed:
<
<
jpsi2mumu.InputLocations = [ "StdLooseMuons" ]
>
>
jpsi2mumu.InputLocations = [ "Phys/StdAllLooseMuons" ]
from SystemOfUnits import MeV jpsi2mumu.MassWindow = 30*MeV jpsi2mumu.MaxChi2 = 100
Line: 33 to 33
# phi2kk = TutorialAlgorithm("Phi2KK");
Changed:
<
<
phi2kk.InputLocations = [ "StdLooseKaons" ]
>
>
phi2kk.InputLocations = [ "Phys/StdAllLooseKaons" ]
phi2kk.MassWindow = 50*MeV phi2kk.Particle = "phi(1020)" phi2kk.MaxChi2 = 20
Line: 49 to 49
# from Configurables import DaVinci DaVinci().HistogramFile = "DVHistos_3.root" # Histogram file
Changed:
<
<
DaVinci().EvtMax = 1000 # Number of events
>
>
DaVinci().EvtMax = 10000 # Number of events
DaVinci().DataType = "2012" # Default
Deleted:
<
<
DaVinci().Simulation = True # It's MC
# # Add our own stuff #
Line: 70 to 69
-- PatrickKoppenburg - 13 Jun 2008 -- PatrickKoppenburg - 05 Jan 2009 -- PatrickSKoppenburg - 16-Oct-2012
>
>
-- PatrickSKoppenburg - 30-Sep-2013
|*META PREFERENCE*|name="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" title="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" type="Set" value="
 ```"| ```

#### Revision 142012-10-16 - PatrickSKoppenburg

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
>
>
WARNING: These optiosn work, but are deprecated. One should now use the Selection Framework as in DaVinciTutorial4.
You could actually use the algorithm from DaVinciTutorial2 to make the Phi too. The procedure for selecting the Phi is the same, it's just the properties of the mother and the type of the daughters that change.

Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like this:

Line: 48 to 50
from Configurables import DaVinci DaVinci().HistogramFile = "DVHistos_3.root" # Histogram file DaVinci().EvtMax = 1000 # Number of events
Changed:
<
<
DaVinci().DataType = "2011" # Default
>
>
DaVinci().DataType = "2012" # Default
DaVinci().Simulation = True # It's MC # # Add our own stuff
Line: 67 to 69
-- PatrickKoppenburg - 01 Oct 2007 -- PatrickKoppenburg - 13 Jun 2008 -- PatrickKoppenburg - 05 Jan 2009
>
>
-- PatrickSKoppenburg - 16-Oct-2012
|*META PREFERENCE*|name="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" title="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" type="Set" value="
 ```"| ```

#### Revision 132011-07-04 - PatrickSKoppenburg

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 48 to 48
from Configurables import DaVinci DaVinci().HistogramFile = "DVHistos_3.root" # Histogram file DaVinci().EvtMax = 1000 # Number of events
Changed:
<
<
DaVinci().DataType = "2008" # Default is "DC06"
>
>
DaVinci().DataType = "2011" # Default
DaVinci().Simulation = True # It's MC # # Add our own stuff

#### Revision 122010-02-02 - RobLambert

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 17 to 17
# # 2) Add the J/psi #
Changed:
<
<
from Configurables import TutorialAlgorithm, PhysDesktop
>
>
from Configurables import TutorialAlgorithm
jpsi2mumu = TutorialAlgorithm("Jpsi2MuMu") jpsi2mumu.InputLocations = [ "StdLooseMuons" ] from SystemOfUnits import MeV
Line: 59 to 59
The solution is given in `solutions/DaVinci3`.
Changed:
<
<

>
>

# Next

-- PatrickKoppenburg - 01 Oct 2007 -- PatrickKoppenburg - 13 Jun 2008

#### Revision 112009-06-09 - RobLambert

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 19 to 19
# from Configurables import TutorialAlgorithm, PhysDesktop jpsi2mumu = TutorialAlgorithm("Jpsi2MuMu")
Changed:
<
<
jpsi2mumu.addTool( PhysDesktop ) jpsi2mumu.PhysDesktop.InputLocations = [ "StdLooseMuons" ]
>
>
jpsi2mumu.InputLocations = [ "StdLooseMuons" ]
from SystemOfUnits import MeV jpsi2mumu.MassWindow = 30*MeV jpsi2mumu.MaxChi2 = 100
Line: 32 to 31
# phi2kk = TutorialAlgorithm("Phi2KK");
Changed:
<
<
phi2kk.addTool( PhysDesktop ) phi2kk.PhysDesktop.InputLocations = [ "StdLooseKaons" ]
>
>
phi2kk.InputLocations = [ "StdLooseKaons" ]
phi2kk.MassWindow = 50*MeV phi2kk.Particle = "phi(1020)" phi2kk.MaxChi2 = 20

#### Revision 102009-03-11 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 19 to 19
# from Configurables import TutorialAlgorithm, PhysDesktop jpsi2mumu = TutorialAlgorithm("Jpsi2MuMu")
Changed:
<
<
>
>
jpsi2mumu.PhysDesktop.InputLocations = [ "StdLooseMuons" ] from SystemOfUnits import MeV jpsi2mumu.MassWindow = 30*MeV
Line: 32 to 32
# phi2kk = TutorialAlgorithm("Phi2KK");
Changed:
<
<
>
>
phi2kk.PhysDesktop.InputLocations = [ "StdLooseKaons" ] phi2kk.MassWindow = 50*MeV phi2kk.Particle = "phi(1020)"

#### Revision 92009-01-08 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.

#### Revision 82009-01-05 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.

You could actually use the algorithm from DaVinciTutorial2 to make the Phi too. The procedure for selecting the Phi is the same, it's just the properties of the mother and the type of the daughters that change.

Changed:
<
<
Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like: %SYNTAX{ syntax="python"}%from os import environ import SystemOfUnits as Units from Gaudi.Configuration import * from Configurables import TutorialAlgorithm, PhysDesktop

importOptions( "\$DAVINCIROOT/options/DaVinciCommon.opts" )

>
>
Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like this: %SYNTAX{ syntax="python"}%from Gaudi.Configuration import * #######################################################################
#
Changed:
<
<
# Let's make it a sequence
>
>
# 1) Let's define a sequence
#
Changed:
<
<
ApplicationMgr().TopAlg += [ "GaudiSequencer/TutorialSeq" ]
>
>
from Configurables import GaudiSequencer tutorialseq = GaudiSequencer("TutorialSeq") #######################################################################
#
Changed:
<
<
# J/psi->mumu selection
>
>
#
Changed:
<
<
jpsi2mumu = TutorialAlgorithm("Jpsi2MuMu");
>
>
from Configurables import TutorialAlgorithm, PhysDesktop jpsi2mumu = TutorialAlgorithm("Jpsi2MuMu")
Changed:
<
<
jpsi2mumu.PhysDesktop.InputLocations = [ "Phys/StdLooseMuons" ] jpsi2mumu.MassWindow = 30*Units.MeV jpsi2mumu.OutputLevel = 3 ; jpsi2mumu.MaxChi2 = 100 ; jpsi2mumu.Particle = "J/psi(1S)" ;

GaudiSequencer("TutorialSeq").Members.append(jpsi2mumu)

>
>
jpsi2mumu.PhysDesktop.InputLocations = [ "StdLooseMuons" ] from SystemOfUnits import MeV jpsi2mumu.MassWindow = 30*MeV jpsi2mumu.MaxChi2 = 100 jpsi2mumu.Particle = "J/psi(1S)" tutorialseq.Members += [ jpsi2mumu ] #######################################################################
#
Changed:
<
<
# Phi->KK selection
>
>
# phi2kk = TutorialAlgorithm("Phi2KK");

Changed:
<
<
phi2kk.PhysDesktop.InputLocations = [ "Phys/StdLooseKaons" ] phi2kk.MassWindow = 50*Units.MeV phi2kk.Particle = "phi(1020)" ; phi2kk.MaxChi2 = 20 ; phi2kk.OutputLevel = 3 ;

GaudiSequencer("TutorialSeq").Members.append(phi2kk)

GaudiSequencer("TutorialSeq").IgnoreFilterPassed = True # get all phis%ENDSYNTAX%

>
>
phi2kk.PhysDesktop.InputLocations = [ "StdLooseKaons" ] phi2kk.MassWindow = 50*MeV phi2kk.Particle = "phi(1020)" phi2kk.MaxChi2 = 20 tutorialseq.Members += [ phi2kk ] ####################################################################### # # Say True to have all phis. False to be fast. # tutorialseq.IgnoreFilterPassed = True # get all phis ####################################################################### # # 3) Configure the application # from Configurables import DaVinci DaVinci().HistogramFile = "DVHistos_3.root" # Histogram file DaVinci().EvtMax = 1000 # Number of events DaVinci().DataType = "2008" # Default is "DC06" DaVinci().Simulation = True # It's MC # # Add our own stuff # DaVinci().UserAlgorithms = [ tutorialseq ]%ENDSYNTAX%
The only necessary change in the C++ code is that you need a variable `(std::string)` that tells the algorithm which Particle to reconstruct. Then in `initialize()` you should ask the `ParticlePropertySvc` to find the mass of this Particle.
Line: 54 to 65
-- PatrickKoppenburg - 01 Oct 2007 -- PatrickKoppenburg - 13 Jun 2008
>
>
-- PatrickKoppenburg - 05 Jan 2009
|*META PREFERENCE*|name="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" title="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" type="Set" value="
 ```"| ```

#### Revision 72008-12-23 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 54 to 54
-- PatrickKoppenburg - 01 Oct 2007 -- PatrickKoppenburg - 13 Jun 2008 \ No newline at end of file
>
>
|*META PREFERENCE*|name="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" title="SYNTAXHIGHLIGHTINGPLUGIN_FORMAT_PREPEND" type="Set" value="
 ```"| ```

#### Revision 62008-06-13 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 50 to 50
The solution is given in `solutions/DaVinci3`.
>
>

# Go to DaVinciTutorial4

-- PatrickKoppenburg - 01 Oct 2007 -- PatrickKoppenburg - 13 Jun 2008

#### Revision 52008-06-13 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Deleted:
<
<
This tutorial corresponds to the slides last shown here. But they might be a little out of date.
You could actually use the algorithm from DaVinciTutorial2 to make the Phi too. The procedure for selecting the Phi is the same, it's just the properties of the mother and the type of the daughters that change.

Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like:

Changed:
<
<
`<!-- SyntaxHighlightingPlugin -->`
```// #include "\$DAVINCIROOT/options/DaVinciCommon.opts"
ApplicationMgr.TopAlg += { "GaudiSequencer/TutorialSeq" };
// J/psi->mumu selection
//
TutorialSeq.Members += { "TutorialAlgorithm/Jpsi2MuMu" };
Jpsi2MuMu.PhysDesktop.InputLocations = { "Phys/StdLooseMuons" } ;
Jpsi2MuMu.Particle = "J/psi(1S)" ;
Jpsi2MuMu.MassWindow = 30*MeV ;
Jpsi2MuMu.MaxChi2 = 20 ;
Jpsi2MuMu.OutputLevel = 3 ;
//
// Phi->KK selection
//
TutorialSeq.Members += { "TutorialAlgorithm/Phi2KK" };
Phi2KK.PhysDesktop.InputLocations = { "Phys/StdLooseKaons" } ;
Phi2KK.Particle = "phi(1020)" ;
Phi2KK.MassWindow = 50*MeV ;
Phi2KK.MaxChi2 = 100 ;
Phi2KK.OutputLevel = 3 ; ```
`<!-- end SyntaxHighlightingPlugin -->`
>
>
`<!-- SyntaxHighlightingPlugin -->`
```from os import environ
import GaudiKernel.SystemOfUnits as Units
from Gaudi.Configuration import *
from Configurables import TutorialAlgorithm, PhysDesktop

importOptions( "\$DAVINCIROOT/options/DaVinciCommon.opts" )

#
# Let's make it a sequence
#
ApplicationMgr().TopAlg += [ "GaudiSequencer/TutorialSeq" ]
#
# J/psi->mumu selection
#
jpsi2mumu = TutorialAlgorithm("Jpsi2MuMu");

jpsi2mumu.PhysDesktop.InputLocations = [ "Phys/StdLooseMuons" ]
jpsi2mumu.MassWindow = 30*Units.MeV
jpsi2mumu.OutputLevel = 3 ;
jpsi2mumu.MaxChi2 = 100 ;
jpsi2mumu.Particle = "J/psi(1S)" ;

GaudiSequencer("TutorialSeq").Members.append(jpsi2mumu)
#
# Phi->KK selection
#
phi2kk = TutorialAlgorithm("Phi2KK");

phi2kk.PhysDesktop.InputLocations = [ "Phys/StdLooseKaons" ]
phi2kk.MassWindow = 50*Units.MeV
phi2kk.Particle =  "phi(1020)" ;
phi2kk.MaxChi2 = 20 ;
phi2kk.OutputLevel = 3 ;

GaudiSequencer("TutorialSeq").Members.append(phi2kk)

GaudiSequencer("TutorialSeq").IgnoreFilterPassed = True # get all phis```
`<!-- end SyntaxHighlightingPlugin -->`
The only necessary change in the C++ code is that you need a variable `(std::string)` that tells the algorithm which Particle to reconstruct. Then in `initialize()` you should ask the `ParticlePropertySvc` to find the mass of this Particle.

The solution is given in `solutions/DaVinci3`.

-- PatrickKoppenburg - 01 Oct 2007 \ No newline at end of file

>
>
-- PatrickKoppenburg - 13 Jun 2008

#### Revision 42008-03-04 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 9 to 9
Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like: %SYNTAX{ syntax="cpp"}%// #include "\$DAVINCIROOT/options/DaVinciCommon.opts"
Deleted:
<
<
#include "\$COMMONPARTICLESROOT/options/StandardMuons.opts" #include "\$COMMONPARTICLESROOT/options/StandardKaons.opts" // kaons too
TopAlg += { "GaudiSequencer/TutorialSeq" }; // J/psi->mumu selection //

#### Revision 32007-11-19 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
>
>
This tutorial corresponds to the slides last shown here. But they might be a little out of date.
You could actually use the algorithm from DaVinciTutorial2 to make the Phi too. The procedure for selecting the Phi is the same, it's just the properties of the mother and the type of the daughters that change.

Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like:

#### Revision 22007-10-02 - unknown

Line: 1 to 1

 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.
Line: 6 to 6
You could actually use the algorithm from DaVinciTutorial2 to make the Phi too. The procedure for selecting the Phi is the same, it's just the properties of the mother and the type of the daughters that change.

Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like:

Changed:
<
<
|
```// #include "\$DAVINCIROOT/options/DaVinciCommon.opts"

```
>
>
%SYNTAX{ syntax="cpp"}%// #include "\$DAVINCIROOT/options/DaVinciCommon.opts"
#include "\$COMMONPARTICLESROOT/options/StandardMuons.opts" #include "\$COMMONPARTICLESROOT/options/StandardKaons.opts" // kaons too TopAlg += { "GaudiSequencer/TutorialSeq" };
Line: 26 to 26
Phi2KK.Particle = "phi(1020)" ; MassWindow = 50*MeV ; MaxChi2 = 100 ;
Changed:
<
<
OutputLevel = 3 ; |
>
>
OutputLevel = 3 ; %ENDSYNTAX%
The only necessary change in the C++ code is that you need a variable `(std::string)` that tells the algorithm which Particle to reconstruct. Then in `initialize()` you should ask the `ParticlePropertySvc` to find the mass of this Particle.

#### Revision 12007-10-01 - unknown

Line: 1 to 1
>
>
 META TOPICPARENT name="DaVinciTutorial"

# DaVinci Tutorial 3

This tutorial is optional. It shows you how to change a specialised algorithm in something more generic. When you'll be writing your own algorithms you're encouraged to write something generic from the start.

You could actually use the algorithm from DaVinciTutorial2 to make the Phi too. The procedure for selecting the Phi is the same, it's just the properties of the mother and the type of the daughters that change.

Adapt `TutorialAlgorithm` in order to be able to select J/psi and Phi depending on the configuration. The options should look like:

 ```// #include "\$DAVINCIROOT/options/DaVinciCommon.opts" #include "\$COMMONPARTICLESROOT/options/StandardMuons.opts" #include "\$COMMONPARTICLESROOT/options/StandardKaons.opts" // kaons too ApplicationMgr.TopAlg += { "GaudiSequencer/TutorialSeq" }; // J/psi->mumu selection // TutorialSeq.Members += { "TutorialAlgorithm/Jpsi2MuMu" }; Jpsi2MuMu.PhysDesktop.InputLocations = { "Phys/StdLooseMuons" } ; Jpsi2MuMu.Particle = "J/psi(1S)" ; Jpsi2MuMu.MassWindow = 30*MeV ; Jpsi2MuMu.MaxChi2 = 20 ; Jpsi2MuMu.OutputLevel = 3 ; // // Phi->KK selection // TutorialSeq.Members += { "TutorialAlgorithm/Phi2KK" }; Phi2KK.PhysDesktop.InputLocations = { "Phys/StdLooseKaons" } ; Phi2KK.Particle = "phi(1020)" ; Phi2KK.MassWindow = 50*MeV ; Phi2KK.MaxChi2 = 100 ; Phi2KK.OutputLevel = 3 ; ```

The only necessary change in the C++ code is that you need a variable `(std::string)` that tells the algorithm which Particle to reconstruct. Then in `initialize()` you should ask the `ParticlePropertySvc` to find the mass of this Particle.

The solution is given in `solutions/DaVinci3`.

-- PatrickKoppenburg - 01 Oct 2007

Copyright &© 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback