!!! PAGE NO LONGER MAINTAINED. KEPT FOR HISTORICAL REASONS !!!

DaVinci Configuration

Introduction

Since DaVinci v22r0 the run configuration can only be done using the DaVinci() configurable. This backward incompatible change is necessary to allow the use of DC06 and 2008 data in a transparent way. The alternative would be to force the user to have a deep knowledge of conditions database tags, optional calibrations, etc... which need to be set depending on the data.

With v22r0 there are two main backward-incompatible changes:

  • DaVinciCommon.opts has been removed. Any option file including it will not work.
  • The only way of configuring the main job options is DaVinci(). It contains all which used to be in DaVinciCommon.opts.

Examples

There is a full example below and there are many examples in the release. The pattern for main options should be as in one of the examples given below.

The most important thing you need to remember is that DaVinci() resets ApplicationMgr().TopAlg when being configured (which is always after what you do). Therefore all your topalgs will be ignored if you don't pass them via UserAlgorithms or MainOptions.

The local approach

You can define everything in a single main option file MyOpts.py.
from Gaudi.Configuration import *                                                # Always at top
##########################################
# Define your sequencer
#
from Configurables import GaudiSequencer
mySeq = GaudiSequencer("MySeq")
#
# Add algorithms to your sequencer here:
# mySeq.Members += ....
##########################################
# Configure the job
#
from Configurables import DaVinci
DaVinci().EvtMax = 100                                                           # Number of events
DaVinci().DataType = "DC06"                                                      # Default is "DC06"
DaVinci().Simulation   = True                                                    # It is MC 
DaVinci().UserAlgorithms = [ mySeq ]                                             # Declare your sequencer

Load an option file

You can also define only the DaVinci() part in your main option file and import the rest from another file.

from Gaudi.Configuration import *                                                # Always at top
##########################################
# Configure the job
#
from Configurables import DaVinci
DaVinci().EvtMax = 100                                                           # Number of events
DaVinci().DataType = "DC06"                                                      # Default is "DC06"
DaVinci().Simulation   = True                                                    # It is MC 
DaVinci().MainOptions = "$DAVINCIROOT/options/MySequence.py"
You can combine MainOptions and UserAlgorithms. In that case the MainOptions are imported first.

This way also allows you to re-use some old text option file. Simply do

DaVinci().MainOptions = "$B2DILEPTONROOT/options/DoPreselBu2LLK.opts"

Preload an option file and catch a sequencer

If you need to mix several imports of options you may do the following:
from Gaudi.Configuration import *                                                # Always at top
from Configurables import GaudiSequencer
##########################################
# Import two predefined sequences
#
importOptions("$B2DILEPTONROOT/options/DoDC06SelBu2MuMuK.py")
importOptions("$CCBARROOT/options/DoDC06SelBs2JpsieePhi.py")
##########################################
# Now catch the sequencers
#
mmK = GaudiSequencer("SeqPreselBu2LLK")
eePhi = GaudiSequencer("DC06SelBs2JpsieePhiFilterSequence")
##########################################
# Configure the job
#
from Configurables import DaVinci
DaVinci().EvtMax = 100                                                           # Number of events
DaVinci().DataType = "DC06"                                                      # Default is "DC06"
DaVinci().Simulation   = True                                                    # It is MC 
DaVinci().UserAlgorithms = [ mmK, eePhi ]                                        # Declare your sequencers
This works because internally DaVinci() resets the topalgs. There is thus a full control on the ordering.

Units

before anything else (or, if you are using a DaVinci version prior to v22r1, importOptions("$DAVINCIROOT/options/PreloadUnits.opts")). If you need units in your text options do
importOptions("$STDOPTS/PreloadUnits.opts")

Run it

In all three cases run it doing
gaudirun.py MyOpts.py $DAVINCIROOT/options/DaVinciTestsData.py
This will work for DC06 as well as for 2008 data.

DaVinci() configurable

There are many things one can set via the DaVinci() configurable. The basic rule is if you can use DaVinci() to set something, don't try to do it differently!

The available options are:

# Application Configuration : sent to LHCbApp and Gaudi
DaVinci().EvtMax              :  -1        # Number of events to analyse
DaVinci().SkipEvents          :   0        # Number of events to skip at beginning for file
DaVinci().PrintFreq           : 100        # The frequency at which to print event numbers
DaVinci().DataType            : 'DC06'     # Data type, can be ['DC06','2008'] Forwarded to PhysConf
DaVinci().Simulation          : True       # set to True to use SimCond. Forwarded to PhysConf
DaVinci().DDDBtag             : 'default'  # Tag for DDDB. Default as set in DDDBConf for DataType
DaVinci().CondDBtag           : 'default'  # Tag for CondDB. Default as set in DDDBConf for DataType
# Input
DaVinci().Input               : []         # Input data. Can also be passed as a second option file.
# Output
DaVinci().HistogramFile       : ''         # Write name of output Histogram file
DaVinci().TupleFile           : ''         # Write name of output Tuple file
DaVinci().ETCFile             : ''         # Name of ETC file
# Monitoring
DaVinci().MoniSequence        : []         # Add your monitors here
# DaVinci Options
DaVinci().MainOptions         : ''         # Main option file to execute
DaVinci().UserAlgorithms      : []         # User algorithms to run.
DaVinci().RedoMCLinks         : False      # On some stripped DST one needs to redo the Track<->MC link table. Set to true if problems with association.
DaVinci().InputType           : 'DST'      # or 'MDST' or 'DIGI' or 'ETC' or 'RDST' or 'DST'. Nothing means the input type is compatible with being a DST. 
# Trigger running
DaVinci().L0                  : False      # Run L0. 
DaVinci().ReplaceL0BanksWithEmulated : False  # Re-run L0 
DaVinci().HltType             : ''         # HltType : No Hlt. Use Hlt1+Hlt2 to run Hlt
DaVinci().HltUserAlgorithms   : [ ]        # put here user algorithms to add
DaVinci().Hlt2Requires        : 'L0+Hlt1'  # Say what Hlt2 requires
This was correct at the time of writing. Check doxygen for the most recent changes, or look into $DAVINCIROOT/python/DaVinci/Configuration.py.

Translating options to python

While .opts files are still supported, it is recommended to translate them to python. The translation is straight-forward, essentially replacing some characters and declaring some imports. Here is an example:
#include "$DAVINCIROOT/options/DaVinciCommon.opts"
// Make a D0
ApplicationMgr.TopAlg += { "CombineParticles/D0" };
D0.PhysDesktop.InputLocations = { "StdLooseKaons", "StdLoosePions" };
D0.DecayDescriptor = "[D0 -> K+ pi-]cc" ;
D0.DaughtersCuts = { "K+" : "(PT>300*MeV) & (P>2*GeV) & (MIPCHI2DV(PRIMARY)>4)",
                    "pi+" : "(PT>300*MeV) & (P>2*GeV) & (MIPCHI2DV(PRIMARY)>4)"};
D0.CombinationCut = "(ADAMASS('D0')<50) & (APT>1*GeV)";
D0.MotherCut = "(VFASPF(VCHI2/VDOF)<25)";
// Run on 100 events
ApplicationMgr.EvtMax = 100 ;
becomes
from Gaudi.Configuration import *                                                # Always at top
## Make a D0                                                                     # Comments start with a #
from Configurables import CombineParticles, PhysDesktop                          # Every configubable must be imported
d0 = CombineParticles("D0")                                                      # Create a Combine Particles instance
d0.addTool(PhysDesktop())                                                        # Tell d0 that you'd like to configure PhysDesktop
d0.PhysDesktop.InputLocations = [ "StdLooseKaons", "StdLoosePions" ]             # Lists have square brackets
d0.DecayDescriptor = "[D0 -> K+ pi-]cc"                                          # Note there's no ; anymore
d0.DaughtersCuts = { "K+" : "(PT>300*MeV) & (P>2*GeV) & (MIPCHI2DV(PRIMARY)>4)", # Dictionaries have {}
                    "pi+" : "(PT>300*MeV) & (P>2*GeV) & (MIPCHI2DV(PRIMARY)>4)"}
d0.CombinationCut = "(ADAMASS('D0')<50) & (APT>1*GeV)"                            
d0.MotherCut = "(VFASPF(VCHI2/VDOF)<25)" 
#
# DaVinci() :
#
from Configurables import DaVinci
DaVinci().EvtMax = 100                                                           # Number of events
DaVinci().DataType = "DC06"                                                      # Default is "DC06"
DaVinci().Simulation   = True                                                    # It is MC 
DaVinci().UserAlgorithms = [ d0 ]                                                # Declare d0

See also

-- PatrickKoppenburg - 23 Dec 2008

Edit | Attach | Watch | Print version | History: r28 < r27 < r26 < r25 < r24 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r28 - 2018-12-05 - EduardoRodrigues
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback