Difference: SimDigiReconTutorial (16 vs. 17)

Revision 172013-07-24 - DavidHutchcroft

Line: 1 to 1
 
META TOPICPARENT name="LHCbSoftwareTutorials"

Generate, digitize and reconstruct two signal events with decays

Bd->J/Psi(mumu)Kshort
Line: 6 to 6
  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
Changed:
<
<
numbers with more recent ones if required. This is setup to generate Sim08 2011 events.
>
>
numbers with more recent ones if required. This is setup to generate Sim08 2012 events.
 
Line: 16 to 17
 

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

Changed:
<
<
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
>
>
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
 
<!-- SyntaxHighlightingPlugin -->
export VO_LHCB_SW_DIR=/cvmfs/lhcb.cern.ch
source $VO_LHCB_SW_DIR/lib/LbLogin.sh -c x86_64-slc5-gcc46-opt
<!-- end SyntaxHighlightingPlugin -->
Changed:
<
<
this uses the code in slc5 compatibility mode as at the time of writing the slc6 versions are not available.
>
>
this uses the code in slc5 compatibility mode as at the time of writing the slc6 versions are not available.
  %SYNTAX{ syntax="sh" }% cd SomeDirectory
Line: 30 to 36
 emacs -nw Gauss-Job.py %ENDSYNTAX%
Changed:
<
<
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.
>
>
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

Line: 42 to 51
 
<!-- SyntaxHighlightingPlugin -->
nEvts = 5
<!-- end SyntaxHighlightingPlugin -->
so that Gauss generates two events.
Changed:
<
<
The output file name will be automatically generated by Gauss, override this if you want by uncommenting the appropriate lines.
>
>
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
Line: 50 to 60
 

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

Go into the

Changed:
<
<
EvtGen web page linked from that of
>
>
[[http://lhcb-release-area.web.cern.ch/LHCb-release-area/DOC/gauss/generator/evtgen.php] [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
Changed:
<
<
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.
>
>
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

Changed:
<
<
  • a standard Gauss jobs with the 2011 geometry
>
>
  • a standard Gauss jobs with the 2012 geometry
 
  • the event type you have chosen
Changed:
<
<
  • what is specific to your job (i.e. number of events, name of output file,...)
>
>
  • what is specific to your job (i.e. number of events, run and first event numbers, 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 
Changed:
<
<
Wait while Gauss configures itself, Pythia, EvtGen and GEANT4, then generates two events.
>
>
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 ====================
=                                                                 =
Changed:
<
<
= Number of particles generated: 948
>
>
= Number of particles generated: 1330
 = Number of events: 2
Changed:
<
<
= Mean multiplicity: 474
>
>
= Mean multiplicity: 665
 = =
Changed:
<
<
= Number of pseudo stable particles generated: 819
>
>
= Number of pseudo stable particles generated: 1120
 = Number of events: 2
Changed:
<
<
= Mean pseudo stable multiplicity: 409.5
>
>
= Mean pseudo stable multiplicity: 560
 = =
Changed:
<
<
= Number of charged stable particles generated: 240
>
>
= Number of charged stable particles generated: 344
 = Number of events: 2
Changed:
<
<
= Mean charged stable multiplicity: 120
>
>
= Mean charged stable multiplicity: 172
 = =
Changed:
<
<
= Number of charged stable particles in LHCb eta 60
>
>
= Number of charged stable particles in LHCb eta 79
 = Number of events: 2
Changed:
<
<
= Mean charged stable multiplicity in LHCb eta: 30
>
>
= Mean charged stable multiplicity in LHCb eta: 39.5
 = =
Added:
>
>
===============================================================
 
Changed:
<
<
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.
>
>
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. The number of hits is also listed in the output log file.

 
Changed:
<
<
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.
>
>
    Counter     |     #     |    sum     | mean/eff^* | rms/err^*  |
"#VeloPU MCHits |         2 |        121 |     60.500 |     35.500 |
"#MCRichTracks" |         2 |        227 |     113.50 |     63.500 |
"#MCRichSegment |         2 |        301 |     150.50 |     82.500 |
...
 

Digitize the two decays made in Gauss

Line: 104 to 133
  %SYNTAX{ syntax="sh" }% SetupProject Boole v26r6
Deleted:
<
<
cp $BOOLEOPTS/MC11-Files.py ./Boole-2011-Files.py
 %ENDSYNTAX%
Changed:
<
<

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

>
>

Create Boole-2012.py to setup Boole to digitize the events generated earlier

 
Changed:
<
<
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.
>
>
Write the file Boole-2012.py containg
 
Deleted:
<
<
So make the following changes to Boole2-2011-Files.py
 %SYNTAX{ syntax="python" }%
Changed:
<
<
#-- Event input LHCbApp().DDDBtag = "Sim08-20130503" LHCbApp().CondDBtag = "Sim08-20130503-vc-md100"

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

>
>
from Configurables import Boole Boole().DataType = "2012" from Configurables import LHCbApp LHCbApp().DDDBtag = "Sim08-20130503-1" LHCbApp().CondDBtag = "Sim08-20130503-1-vc-md100" inputFiles = ['Gauss-11144103-2ev-20130724.sim'] # wants a list of files from GaudiConf import IOHelper IOHelper('ROOT').inputFiles(inputFiles) # name the ouput file the same as the first input file with Gauss->Boole # DatasetName also sets histogram output file name Boole().DatasetName = inputFiles[0].replace('Gauss','Boole').replace('.sim','') %ENDSYNTAX%

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 $GAUSSOPTS/Gauss-2012.py which you used earlier and is also in the Gauss log file near the top. Check the values above are still correct.

 

Run Boole and check the output

Run Boole with

Changed:
<
<
gaudirun.py Boole-2011-Files.py | tee BsJPsiKs-2evt_Boole.log
>
>
gaudirun.py Boole-2012.py | tee BsJPsiKs-2evt_Boole.log
 

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

Line: 134 to 172
 

Use Moore to simulate the trigger for the events

Changed:
<
<
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.

>
>
Use the same instructions as for Gauss and Boole to setup Moore version v14r12.
 
Changed:
<
<
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).
>
>
Setup an configuration file for Moore, which sets the trigger TCK to configure a consistent trigger: Save the following to a file called Moore-2012.py (correct the input file name to the one Boole created).
  %SYNTAX{ syntax="python" }% from Configurables import Moore
Changed:
<
<
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().DDDBtag = "Sim08-20130503-1" Moore().CondDBtag = "Sim08-20130503-1-vc-md100"
 
Added:
>
>
fileList = ['Boole-11144103-2ev-20130724.digi']
 Moore().inputFiles = fileList
Added:
>
>
# output filename is same as input file with Boole->Moore (both .digi)
 Moore().outputFile = Moore().inputFiles[0].replace('Boole','Moore') %ENDSYNTAX%

then run with

Changed:
<
<
gaudirun.py Moore-2011.py | tee BsJPsiKs-2evt_Moore.log
>
>
<!-- SyntaxHighlightingPlugin -->
gaudirun.py Moore-2012.py $APPCONFIGOPTS/Moore/DataType-2012.py | tee BsJPsiKs-2evt_Moore.log
<!-- end SyntaxHighlightingPlugin -->

Note the output will be very long as we have a lot of trigger lines.

 

Use Brunel to reconstruct the events digitized with Boole

Line: 183 to 209
 %SYNTAX{ syntax="python" }% from Gaudi.Configuration import * from Configurables import Brunel, LHCbApp
Added:
>
>
LHCbApp().DDDBtag = "Sim08-20130503-1" LHCbApp().CondDBtag = "Sim08-20130503-1-vc-md100"
  #-- Event input
Deleted:
<
<
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'"]

 
Changed:
<
<
Brunel().DatasetName = datasetName # sets output and histogram file names Brunel().DataType = '2011' # sets the 2011 configuration of Brunel
>
>
inputFiles = ['Moore-11144103-2ev-20130724.sim'] # wants a list of files from GaudiConf import IOHelper IOHelper('ROOT').inputFiles(inputFiles) # name the ouput file the same as the first input file with Gauss->Boole # sets output and histogram file names Brunel().DatasetName = inputFiles[0].replace('Moore','Brunel').replace('.digi','') Brunel().DataType = '2012' # 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 %ENDSYNTAX%
Changed:
<
<
Save the above in Brunel-2011-Files.py to set up Brunel.
>
>
Save the above in Brunel-2012.py to set up Brunel.
  Then run Brunel with
Changed:
<
<
gaudirun.py Brunel-2011-Files.py | tee BsJPsiKs-2evt_Brunel.log
>
>
gaudirun.py Brunel-2012.py | tee BsJPsiKs-2evt_Brunel.log
  Again check the output log file and the histograms produced.
 
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