User Tools

Site Tools


start:davinciexample

This is an old revision of the document!


DaVinci Example

This example creates a simplified version of the algorithm described in DaVinciTutorial4.

Preparations

  • login to lxplus
  • make sure you have a Grid-Certificate

Create Python Configuration

myOptions.py
from Gaudi.Configuration import *                                          
from GaudiKernel.SystemOfUnits import MeV, GeV
from Configurables import CombineParticles
from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand
 
# prepare input data
_muons = DataOnDemand('_stdLooseMuons', Location = 'StdLooseMuons')
 
# create algorithm
myalg = CombineParticles("myalg")
 
# define decay and cuts
myalg.DecayDescriptor = "J/psi(1S) -> mu+ mu-"
myalg.CombinationCut = "ADAMASS('J/psi(1S)')<30*MeV"
myalg.MotherCut = "(VFASPF(VCHI2/VDOF)<10)"
 
# add plots to algorithm
from Configurables import LoKi__Hybrid__PlotTool as PlotTool
myalg.HistoProduce = True
myalg.addTool ( PlotTool ( 'DaughtersPlots' ) )
myalg.DaughtersPlots.Histos = {
   'P'  : ('momentum' , 0*GeV ,30*GeV) ,
   'M'  : ('mass'     ,0*GeV,1*GeV)
   }
myalg.addTool( PlotTool ( "MotherPlots" ) )
myalg.MotherPlots.Histos = {
   "P"  : ('momentum',0*GeV,100*GeV) ,
   "M"  : ('mass',0*GeV,4*GeV)
   }
 
# create selection
# Selection needs to be defined after all changes to the Algorithm
LooseJpsi2MuMu = Selection("seqLooseJPsi2MuMu", Algorithm = myalg, RequiredSelections =[ _muons ])
 
# start selection sequence
mySeq = SelectionSequence("mySeq", TopSelection = LooseJpsi2MuMu)
 
# configure the application.
from Configurables import DaVinci
DaVinci().UserAlgorithms = [ mySeq.sequence() ]
DaVinci().HistogramFile  = "histograms.root"    # Histogram file
DaVinci().EvtMax         = 1000                  # Number of events to loop over
DaVinci().DataType       = "MC09"               # Default anyway
DaVinci().Simulation     = True                 # It's MC

Prepare Data Files

  • run the Bookkeeping-GUI
lhcb_bkk
  • select
MC / MC09 / Beam5TeV-VeloClosed-MagDown-Nu1 / MC09-Sim03Reco02-withTruth / 24142000 / DST
  • double-click on Nb of Files/Events and select all files
  • if you want to run on the grid
    • click “Save Files”
  • if you want to run locally
    • click “Advanced Save”
    • give Filename, select PFN(s) and CERN
    • click “save”

Run

Running Locally

SetupProject DaVinci
gaudirun.py myOptions.py myFiles.py

Running With Ganga

  • Set environment
SetupProject Ganga
  • maybe you need to create a new config file
ganga -g
  • start
ganga
  • prepare job
t = JobTemplate( application = DaVinci( ))
t.application.optsfile = [File( "~/example/myOptions.py" ), File( "~/example/myFiles.py" )]
# or you select the files in the Bookkeeping-GUI:
# t.inputdata = browseBK()
j = Job( t, backend = Interactive() )
j.submit()

More Info

You can find more info at following locations:

start/davinciexample.1265363107.txt.gz · Last modified: 2010/02/05 10:45 by nchiap