Generate, digitize and reconstruct two signal events with decays

Bd->J/Psi(mumu)Kshort

This tutorial shows you how to simulate, digitize and reconstruct signal events so that they can be analyzed in DaVinci. The versions of the code quoted are available in July 2013 and replace the version numbers with more recent ones if required. This is setup to generate Sim08 2011 events.

Using Gauss to simulate events

The slides that explain what the program Gauss does are here.

Setup a version of Gauss from the default installation at your site (or CERN)

Log in to lxplus or if it is installed locally any computer with access to the LHCb software. If CVMFS is available it is the recommended way to access the LHCb software, setup with

export VO_LHCB_SW_DIR=/cvmfs/lhcb.cern.ch
source $VO_LHCB_SW_DIR/lib/LbLogin.sh -c x86_64-slc5-gcc46-opt
this uses the code in slc5 compatibility mode as at the time of writing the slc6 versions are not available.

cd SomeDirectory
SetupProject Gauss v45r3
cp $GAUSSOPTS/Gauss-Job.py ./
emacs -nw Gauss-Job.py

The SetupProject sets the environment variables to run Gauss with the specific version. That line must always be executed each session before Gauss is run, although it is only needed once per terminal. SomeDirectory is a directory where the options, outputs and log files for the jobs will be stored. You should probably create this using mkdir if you do not have a suitable place already. The emacs line can be replaced with an editor of your choice.

Edit Gauss-Job.py to simulate the required events

Change the 5 in line

nEvts = 5
so that Gauss generates two events.

The output file name will be automatically generated by Gauss, override this if you want by uncommenting the appropriate lines.

Save the file and quit emacs

Find out the event type for Bd->J/Psi(mumu)Kshort

Go into the EvtGen web page linked from that of DecFiles and find out the event type for the decay you want to simulate. You will want to generate events with the decay products in the acceptance so pick one with DecProdCut in the name (the table is at the end). For Bd->J/Psi(mumu)Kshort this means you will pick 11144103. Clicking on the number of the decay will take you to the official file in python detailing how the decay will be generated.

Run Gauss and look at the monitoring output

To run Gauss you will use the command gaudirun.py and specify that you want

  • a standard Gauss jobs with the 2011 geometry
  • the event type you have chosen
  • what is specific to your job (i.e. number of events, name of output file,...)
You will do so providing the appropriate arguments to the command, as in this case
gaudirun.py Gauss-Job.py $GAUSSOPTS/Gauss-2011.py $DECFILESROOT/options/11144103.py | tee BsJPsiKs-2evt_Gauss.log 

Wait while Gauss configures itself, Pythia, EvtGen and GEANT4, then generates two events.

You should see a very long file produced, the bit where it tells you about the particles generated is here:

======================== Generators Statistics ====================
=                                                                 =
= Number of particles generated: 948
= Number of events: 2
= Mean multiplicity: 474
=                                                                 =
= Number of pseudo stable particles generated: 819
= Number of events: 2
= Mean pseudo stable multiplicity: 409.5
=                                                                 =
= Number of charged stable particles generated: 240
= Number of events: 2
= Mean charged stable multiplicity: 120
=                                                                 =
= Number of charged stable particles in LHCb eta 60
= Number of events: 2
= Mean charged stable multiplicity in LHCb eta: 30
=                                                                 =
showing the number of particle types created in each event. Note this is not the end of the log file and may have scrolled off the top of the screen. The | tee bit of above command means there is a copy of the output file in BsJPsiKs-2evt.log.

Look at the histogram file produced called something like Gauss-11144103-2ev-20130724-histos.root and check there are hits in the VELO, RICH etc.

Digitize the two decays made in Gauss

Setup access to a version of Boole

SetupProject Boole v26r6
cp $BOOLEOPTS/MC11-Files.py ./Boole-2011-Files.py

Edit Boole-2011-Files.py to setup Boole to digitize the events generated earlier

Change the input data file to the Gauss-11144103-2ev-20130724.sim file you generated earlier in Gauss (note the date part will be different to this one!). Also you must always make the DDDBtag and CondDBtag values match as these control the detector geometry and alignment. This must be the same in Gauss and Boole, the values used in Gauss can be found from the file Gauss-2011.py which you copied earlier.

So make the following changes to Boole2-2011-Files.py

#-- Event input
LHCbApp().DDDBtag   = "Sim08-20130503"
LHCbApp().CondDBtag = "Sim08-20130503-vc-md100"

datasetName = "Gauss-11144103-2ev-20130724"
EventSelector().Input = ["DATAFILE='PFN:" + datasetName + ".sim'"]

Run Boole and check the output

Run Boole with gaudirun.py Boole-2011-Files.py | tee BsJPsiKs-2evt_Boole.log

Look at the histograms produced by Boole in BsJPsiKs-2evt-histos.root, check there are entries in the histograms.

Use Moore to simulate the trigger for the events

Moore is very localized, only a few versions work with each TCK, for 2011 simulation the last compatible version is v12r9p5 (if a trigger expert knows better please correct this). That version predates releases on gcc46 so setup gcc43:

source $VO_LHCB_SW_DIR/lib/LbLogin.sh -c x86_64-slc5-gcc43-opt or on lxplus just source LbLogin.sh -c x86_64-slc5-gcc43-opt

Use the same instructions as for Gauss and Boole to setup Moore version v12r9p5 after setting the environment to gcc43.

Setup an configuration file for Moore, which sets the trigger TCK to configure a consistent trigger: Save the following to a file called Moore-2011.py (correct the input file name to the one Boole created).

from Configurables import Moore
Moore().UseTCK = True # provide an invalid TCK here so one is forced to append eg. Conditions/TCK-0x00051810.py
Moore().InitialTCK = '0x40760037'
Moore().L0 = True
Moore().ReplaceL0BanksWithEmulated = True
Moore().UseDBSnapshot = False
Moore().EnableRunChangeHandler = False
Moore().CheckOdin = False
Moore().WriterRequires = []
Moore().Simulation = True
from Configurables import L0MuonAlg
L0MuonAlg( "L0Muon" ).L0DUConfigProviderType = "L0DuConfigProvider"


from Configurables import Moore
Moore().DDDBtag   = "Sim08-20130503"
Moore().CondDBtag = "Sim08-20130503-vc-md100"

fileList = ['Gauss-11144103-2ev-20130724.digi']

Moore().inputFiles = fileList
Moore().outputFile = Moore().inputFiles[0].replace('Boole','Moore')

then run with

gaudirun.py Moore-2011.py | tee BsJPsiKs-2evt_Moore.log

Use Brunel to reconstruct the events digitized with Boole

Setup Brunel version v44r5.

The Brunel options required to run the job are the values of DDDBtag and CondDBtag, the input file name and type and the required output from Brunel.

We can write a file that sets all of this:

from Gaudi.Configuration import *
from Configurables import Brunel, LHCbApp

#-- Event input
LHCbApp().DDDBtag   = "Sim08-20130503"
LHCbApp().CondDBtag = "Sim08-20130503-vc-md100"

datasetName = "Moore-11144103-2ev-20130724"

EventSelector().Input = ["DATAFILE='PFN:" + datasetName + ".digi?svcClass=default' TYP='POOL_ROOTTREE' OPT='READ'"]

Brunel().DatasetName = datasetName # sets output and histogram file names
Brunel().DataType = '2011'  # sets the 2011 configuration of Brunel
Brunel().InputType = "DIGI" # input has the format digi
Brunel().WithMC    = True   # use the MC truth information in the digi file

Save the above in Brunel-2011-Files.py to set up Brunel.

Then run Brunel with gaudirun.py Brunel-2011-Files.py | tee BsJPsiKs-2evt_Brunel.log

Again check the output log file and the histograms produced.

-- DavidHutchcroft - 24-Jul-2013

Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r16 - 2013-07-24 - DavidHutchcroft
 
    • 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-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