Title: Printing and Job Options
1Printing and Job Options
2Objectives
- After completing this session, you should be able
to - Know how to print.
- Know how to steer algorithms with job options.
- Know basic job options.
3Message Service
- Why not use stdcout, stdcerr, ... ?
- They surely print, but
- Do you always want to print to the log file?
- How can you connect stdcout to the message
window of an event display? - You may want to switch on/off printing at several
levels just for one given algorithm, service etc.
4MsgStream
- Use of the MsgStream class
- Usable like standard stream
- Different levels of printing - OutputLevel
- MSGNIL (0) DEFAULT
- MSGVERBOSE (1)
- MSGDEBUG (2)
- MSGINFO (3)
- MSGWARNING (4)
- MSGERROR (5)
- MSGFATAL (6)
- MSGALWAYS (7)
- Record, not line oriented
- Allows to define the severity level per object
instance - MessageSvc.OutputLevel 3
- MyAlgorithm.OutputLevel 2
5Athena job configuration
- Job is essentially steered by a conventional text
file. Future options are - Database
- Scripting (interactive session) already in
working shape - Options properties are accessed through
framework interfaces, IJobOptionsSvc or
IScriptingSvc - when scripting is activated - .
With reference to the past, think of job options
as data cards. But it is more than that!
6JobOptions details
- In TestRelease/ltversiongt/run/jobOptions.txt
- Standard Configuration
- include "Atlas_Gen.UnixStandardJob.txt
- include StandardAtlfastOptions.txt
- Maximum number of events to execute
- ApplicationMgr.EvtMax ltintegergt
- Component libraries to be loaded
- ApplicationMgr.DLLs ltcomma separated array
of stringgt - Top level algorithms Type/ObjectName
- ApplicationMgr.TopAlg ltcomma separated Array
of stringgt - Comments
- Preceded by //
- Atlfast makes use of Sequences lists of
Algorithms controlled by a Sequencer. This allows
for more control on the execution schedule. - a single instance of Sequencer/TopSequenceas
TopAlg - TopSequence has two Sequencer members Generator
Atlfast - Atlfast sequence defined into included
StandardAtlfastOptions.txt
7Job Options Data Types
- Primitives
- bool, int, double, long, stdstring
- Arrays of primitives
- stdvectorltboolgt, stdvectorltdoublegt, ...
- Templated Property SimplePropertyltTgt
- e.g., SimplePropertyltintgt m_int
- adds bounds checking
- m_int.setBounds(lower, upper)
- m_int.setUpper(upper) m_int.setLower(lower)
-
8Declare algorithms properties
- Declare data member as property variable (.h)
- class AnalysisSkeleton public Algorithm
private ... - ...
-
- Declare the property in the Constructor (.cxx)
AnalysisSkeleton AnalysisSkeleton( ltargsgt )
ltinitializationgt -
- ...
-
- ...
-
double m_rCellIsolation
declareProperty(RCellIsolation,
m_rCellIsolation)
declareProperty(YourChosenName, datamember)
9Exercises
- Whenever you change code
- Issue
- From TestRelease/ltversiongt/cmt
- cmt broadcast gmake
or cmt broadcast selectltpckggt gmake
- File path is first argument of executable
- From TestRelease/ltversiongt/run
- athena ltmy jobOptions filegt
- Add AnalysisSkeleton instance to Atlfast
sequencer - In jobOptions.txt, add at very bottom
- Atlfast.members AtlfastAnalysisSkeleton/Ana
lysisSkeleton
10Hands On MsgStream
- Print messages with MsgStream
- Add message stream header to AnalysisSkeleton.cxx
- include GaudiKernel/MsgStream.h
- Create MsgStream object and print
- For example, in initialize()
- MsgStream log(msgSvc(), name())log ltlt
MSGINFO - ltlt Initializing AnalysisSkeleton
- ltlt endreq
11Hands On AnalysisSkeleton.h
- class AnalysisSkeleton public Algorithm
- ...
- private
- //------------------------------------------------
--------- - // Member variables
- //------------------------------------------------
--------- - //cone to sum energy for particles isolation
- double m_rCellIsolation
- //location within the TES of Atlfast objects
collections - stdstring m_particleLocation
-
- ...
12Hands On AnalysisSkeleton.cxx
- In constructor
- AnalysisSkeletonAnalysisSkeleton( const
stdstring name, ISvcLocator pSvcLocator)
Algorithm(name, pSvcLocator) -
- ...
- // Declare parameters to the framework so that
they can be over-written - // via jobOption files
- declareProperty( RCellIsolation,
m_rCellIsolation) - declareProperty( ParticleLocation,
m_particleLocation) - ...
-
Check values StatusCode AnalysisSkeletoninitiali
ze( ) MsgStream log ( msgSvc( ), name( )
)... log ltlt MSGINFO ltlt Isolated electrons
at TES location ltlt m_particleLocation ltlt
endreq ltlt Isolation cone R-value ltlt
m_rCellIsolation ltlt endreq ...
lt-- flush record
13Hands On Set Properties
- Set properties in jobOptions file
- C like syntax
- AnalysisSkeleton.RCellIsolation 0.2
- AnalysisSkeleton.ParticleLocation
/Event/AtlfastIsolatedElectrons
ltObject namegt.ltProperty namegtltProperty valuegt
Build and run athena
- Try it out
- in /cmt (should be in one of your xterm windows)
- cmt broadcast gmake
- will take some time.
- in /run (on your second xterm window)
- athena grep AnalysisSkeleton