Exercise linked to printing and Job options lesson
The purpose of this exercise is to make you familiar with using job options to configure algorithms, and with the methods for printing from within a Gaudi application.
1. Setting up the environment
We will be working in the same environment as the DaVinci tutorial.
- Choose the DaVinci environment
- Check out and configure the Tutorial package
DaVinciEnv v17r5
cd ~/cmtuser
getpack Tutorial/Analysis v6r1 ; cd Tutorial/Analysis/v6r1
This package contains a requirements file already set up for the
tutorial, a set of solutions for the DaVinci tutorial sessions, and
empty src and options directories 2. Creating a DaVinci algorithm, adding a property and printing its value
- Create a new header file using emacs
- Add a member variable to store the property
- Create the corresponding .cpp file
- declare a name for the property and initialize it to a default value
- print the property's value twice, using two different units
- Save both files and build a library with them
emacs src/TutorialAlgorithm.h &
We will be working with DaVinci, so you should answer "D" to emacs, this creates a header file for a DVAlgorithm
double m_jPsiMassWin;
emacs src/TutorialAlgorithm.cpp &
declareProperty( "MassWindow", <memberVariable> = <defaultValue>);
info() << "Mass window is " << value << " Units" << endmsg;
3. Setting up the job options and running the job
- Create a job options file
- Add the default DaVinci configuration
- Add your library and your algorithm
- Do not forget to define "some" input data:
#include "$DAVINCITUTORIALDATA"
- Save the file and run the job. Don't forget to set the environment by sourcing setup.csh
emacs options/myJob.opts
#include "$DAVINCIROOT/options/DaVinciCommon.opts"
ApplicationMgr.DLLs += {...};
ApplicationMgr.TopAlg += {...};
DaVinci $ANALYSISROOT/options/myJob.opts
4. Modify the job behaviour by changing job options
Rerun the job after each of the following modifications. No need to recompile unless you change the .cpp!- Reduce the amount of job options printout by putting the following lines in the appropriate places
- Modify the value of the algorithm's property
- Change the global output level of the application
- Change the output level of your algorithm
- Run two instances of your algorithm, with different values for the cut. Hint: the TopAlg property has the following format:
#pragma print off
#pragma print on
<MyAlg>.MassWindow = 1.2*GeV;
MessageSvc.OutputLevel = 2;
Try any values between 1 and 5
<MyAlg>.OutputLevel = 2;
Try any values between 1 and 5
ApplicationMgr.TopAlg += { "<class name>/<instance name>" };