1 / 62

Athena and HEC Test Beam Reconstruction Tutorial

Learn Athena terms, code development, HEC TB software basics, write simple analysis programs using example codes. Setup and use tutorial on own account at CERN. Understand CMT environment for package management.

wfielder
Download Presentation

Athena and HEC Test Beam Reconstruction Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Athena and HEC Test Beam Reconstruction Tutorial October 12, 2001 CERN N. Kanaya, M. Marino, S. Rajagopalan, M. Wielers

  2. Aims for the Tutorial • At the end of the day you should: • Be more familiar with terms and concepts in Athena • Be able to understand code development of Algorithms • Know some basics about HEC TB software and data structure in Athena • Be able to write simple analysis programs • We will do that using a simple LArg calorimeter cell reconstruction code and the HEC TB software as example • Tutorial based on Frascati Athena Tutorial and LArg Tutorial

  3. Tentative Schedule

  4. Configuration and Build System

  5. Objectives • After completing this session, you should be able to: • Understand the basics of the Configuration Management • Get a copy of a package from the repository • Know how to (re)build libraries and programs

  6. The Student Accounts • Each terminal has a unique student account • student1, student2, student3, … • Log in to your student account • use the username pasted on your terminal • From there you must telnet to the ATLAS Linux boxes: • The code will not work on the SUN boxes • telnet lxplus03N.cern.ch, N=1, 2, … 0 • Use the username: atltr1, atltr2, atltr3, … atltr9, atltra, atltrb • password = ATLtrain

  7. Setting up on your own account If you want to use the tutorial with your own account at CERN follow these steps • Logon to an atlas linux machine, atlinux.cern.ch • Type “zsh” if this is not already your default shell • The files for the tutorial are in /afs/cern.ch/atlas/project/training/LArTutorial • Run the setup script > source /afs/cern.ch/atlas/project/training/LArTutorial2/scripts/Setup_Tutorial.sh • This should setup the environment variables, including $LArTutorial • Goto an appropriete directory for the tutorial checkout and exercise, for example, a maxidisk area. • If this area is different from $HOME/maxidisk you have to change the aliases in the setup script. • If you have problems with the exercises look at the solutions in $LArTutorial/solutions

  8. The Students Accounts • Each account has its own maxidisk space: • cd maxidisk • Create working directory • mkdir Tutorial • cd Tutorial • All exercises will be done within this directory and below • To set up some convenient aliases run the setup script • source /afs/cern.ch/atlas/project/training/LArTutorial2/ scripts/Setup_Tutorial.sh

  9. Convenient symbols Alias: goto_source Changes working directory ‘source area’ goto_header Changes working directory ‘header area’ goto_build Changes working directory to ‘build area’ goto_run Changes working directory to ‘run area’ Environment variables: $source_area Env. Variable pointing to your source area $build_area Env. Variable pointing to your build area $run_area Env. Variable pointing to your run area This should setup in addition the environment variable where our examples are located $LArTutorial

  10. Setting up the ATLAS Software • Packages are maintained with Software Release Tools – CMT • Suite of tools and other facilities for the developers of relatively large and complex software systems. • Looks after the process of building and releasing products such as libraries and executables • Version management is under CVS • Warning: CMT is still being developed and has known problems • Changes in recommended instructions will occur • useful documentation • CMT Manual: • http://www.lal.in2p3.fr/SI/CMT/CMT.html • Using CMT in ATLAS • http://ghez.home.cern.ch/ghez/Temp/doc • D. Quarries talk in september SW week • CMT itself can establish a login environment • You don’t have to use it, but it makes life easier

  11. Setting up the CMT Environment • It involves the presence of a requirements file in your home or work directory • Works with all supported shells (tcsh, zsh, bash, etc.) • Needs to be modified to suit your needs • Typical things to change in requirements file: • Your location (CERN, BNL, etc.) • set CMTSITE “CERN” • The current base release • set ATLAS_RELEASE 2.1.1

  12. Setting up the CMT environment • Set up CMT environment • cd • cp $LArTutorial/scripts/requirements . • Do this in your home directory • source /afs/cern.ch/sw/contrib/CMT/v1r9/mgr/setup.sh • Make CMT commands available • cmt config • Environment set according to requirements files • setup.[c]sh created in your directory • source setup.sh –tag=egcs • Set compiler option egcs or gcc • Default option if compiler not specified: egcs • Now your CMT path is setup correctly • The above needs to be done once for your working package

  13. Setting up the CMT/Athena Environment (for example the next day) • Each time you login you get the right environment for CMT by • source setup.[c]sh • Rerun the “source setup.[c]sh” each time you change the requirements files • In case the setup.[c]sh is in your home directory you might put the “source setup.[c]sh” in your login script • You can put the requirements file as well in another place (might be useful if you run several releases with different CMT version)

  14. Setting up the CMT/Athena Environment (for example the next day) • If you want to run again your athena program you have to set up the right environment • Get right CMT environment • source setup.[c]sh // in home directory • Set some more CMT environment variables for your release • . setCMTTEST // in Tutorial area (was created // by getfirstexercice) • Get environment set up for running athena TestRelease/cmt directory (goto_build) • source setup.[c]sh // in TestRelease/cmt • Hopefully you are not confused,…. I am • Things will be cleaned up in the future… • If you run tcsh you might have the message “word too long” • cut your $PATH down to the minimum • e.g. use script $LArTutorial/path • zsh might reveal other problems, don’t get frustrated….

  15. Creating a Test Release • Even if you just want to run an Athena version without building, the safest way (at the moment) is to checkout the TestRelease package • cmt co TestRelease • This checkouts a skeleton package from CVS which you modify to control building other packages that you checkout • In this tutorial we do not check out the TestRelease but copy it from the tutorial area!!! • Note that packages are checked out from CVS using the “cmt co” or “cmt checkout” command • In general don’t use the “cvs co” command • You need not check out any other packages, unless you need to rebuild the libraries. Otherwise you can use the libraries from the release area. • Sometimes the A-Team may require you to check out and rebuild packages such as:EventAthena, AthenaCommon, Zebra TDRCnv, McEventSelector, GaudiInterface ….Watch out for e-mail

  16. Creating a Test Release • To create a TestRelease for this Tutorial go to your Tutorial area • cp $LArTutorial /scripts/getfirstexercise . • . getfirstexercise • Look at the build script • In TestRelease/cmt you have to add the packages you want to use in the requirements file • Note, here you have another requirements file + setup.[c]sh. This one is for Athena! • Typical things you might change in here • A location for your “default” test release macro CMTTEST “${HOME}/maxidisk/Tutorial” • The version of the GAUDI release (We’re trying to avoid having to specify this) macro CMTGAUDI “/afs/cern.ch/atlas/offline/external/Gaudi/0.7.3”

  17. Creating a Test Release • Build all the checked out packages using • cmt broadcast cmt config • cmt broadcast gmake • Alternatively you could run “cmt config” and “gmake” in the cmt directory of the package you want to build • Set up your run directory and and link some “standard” run files

  18. Exercise 1 • Perform the general setup for CMT • Run the script to build your TestRelease • This will create the shared libraries for all the packages that you have checked out and install it. You need to do this only once for this Tutorial. • Note: you will get quite some messages for incompatible versions for CLHEP, HTL and some missing libraries • Ignore them and hope it runs…. • Try to understand what’s done in the script • Run the athena executable • athena • Does it work? • Yes: Great you got over the 1st hurdle! • No: Cry for help

  19. Working in the Athena Framework

  20. What is a Framework? • Framework Definition [1,2] • Architectural pattern that codifies a particular domain. It provides the suitable knobs, slots and tabs that permit clients to use and adapt to specific applications within a given range of behavior. • In practice • A skeleton of an application into which developers plug in their code and provides most of the common functionality. [1] G. Booch, “Object Solutions”, Addison-Wesley 1996 [2] E. Gamma, et al., “Design Patterns”, Addison-Wesley 1995

  21. Framework Benefits • Common basis • Everyone plugs in code in same framework • Everyone uses the same services (no need to reinvent the wheel again and again) • Low coupling between concurrent developments • Smoother integration & organization of the development. • Robustness • Resilient to change (change-tolerant). • Fosters code re-use

  22. Athena-Gaudi Object Diagram Application Manager StoreGate Svc Converter Converter Converter Event Selector Transient Event Store Data Files Message Service Persistency Service Event Data Service JobOptions Service MC Event Generators Algorithm Algorithm Data Files Transient Detector Store Sequencer Particle Prop. Service Persistency Service Detec. Data Service Other Services Data Files Transient Histogram Store Persistency Service Auditors Histogram Service Scripting Service

  23. Definition of Terms (1) • Algorithms: • Users write Concrete Algorithms • Must inherit from Algorithm class • Implements three methods for invocation by framework : • initialize(), execute(), finalize() • Can be simple or composite Algorithm • Composite Algorithms are made up of several sub-algorithms • Data Object (Collection) • Produced by Algorithms • Atomic unit (visible & managed by transient data store) of data • e.g., a Collection of Clusters produced by an Algorithm • Collection containing several Cluster Objects (Contained Object)

  24. Definition of Terms (2) • Transient Data Store(s) • Central service and repository for data objects (data location, life cycle, load on demand, …) • Event store, detector data store, histogram store • Should be accessed via Storegate • Services • Globally available software components providing specific framework capabilities, e.g. Histogram service • Data Converter • Provides explicit/implicit conversion from/to persistent data format to/from transient data • Decouple Algorithm code from underlying persistency mechanism(s)

  25. Definition of Terms (3) • Properties • Control and data parameters for Algorithms and Services. Allow for run-time configuration. Specified via a startup text file (jobOption file) or Python script or from the scripting language shell • Job Options files • Conventional text file (default jobOptions.txt) used to control an Athena application configuration at run-time • Auditors, sequences, Filters… • See Athena documentation

  26. Algorithm & Transient Store Simulated Data Flow Data T1 Data T1 Transient Event Data Store Data T1 Algorithm A Data T2, T3 Data T2 Algorithm B Data T4 Data T3, T4 Algorithm C Apparent dataflow Data T5 Real dataflow Data T5

  27. Accessing Services • Within the Algorithm services are readily accessible. • The most common are: • msgSvc( ) [or messageService( )] • eventSvc( ) [or eventDataService( )] • histoSvc( ) [or histogramDataService( )] • ntupleSvc( ) [or ntupleService( )] • detSvc( ) [or detDataService( )] • service<T>(…) generalized access to Services • serviceLocator( ) • And more…

  28. Documentation • Athena User Guide v1.3.0 - new version in preparation & release notes • Gaudi Developer Guide v7 • Both from http://atlas.web.cern.ch/Atlas/GROUPS/SOFTWARE/OO/architecture/General/index.html • Athena Examples • http://atlas.web.cern.ch/Atlas/GROUPS/SOFTWARE/OO/architecture/General/Tech.Doc/Build/ReleaseNotes.txt • LAr Tutorial • http://atlas.web.cern.ch/Atlas/GROUPS/LIQARGON/ software/Reconstruction • Athena Tutorial • http://atlas.web.cern.ch/Atlas/GROUPS/SOFTWARE/OO/ architecture/General/Tutorial/18may01

  29. Printing and Job Options

  30. Objectives • 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.

  31. Message Service • Include header file: • #include “Gaudi/MessageSvc/MsgStream.h” • To print message: • MsgStream log(msgSvc(), name()); • log << MSG::INFO << “Hello there” << endreq; • Use of the MsgStream class • Different levels of printing - OutputLevel: MSG::NIL (=0) DEFAULT (not yet avail.) MSG::VERBOSE (=1) (not yet avail.) MSG::DEBUG (=2) MSG::INFO (=3) MSG::WARNING (=4) MSG::ERROR (=5) MSG::FATAL (=6) • Message Level specified in jobOptions file: • MessageSvc.OutputLevel = 3; • Settable per Algorithm: • MyAlgorithm.OutputLevel = 2;

  32. Athena job configuration • Job is essentially steered by a conventional text file. Future options are: • Database • Scripting (interactive session) under development but already in working shape • Options & properties are accessed throughframework interfaces, IJobOptionsSvc or IScriptingSvc - when scripting is activated - . With reference to the past, think of data cards. But it is more than that!

  33. JobOptions details In jobOptions.txt Standard Configuration #include "Atlas_TDR.UnixStandardJob.txt” Maximum number of events to execute ApplicationMgr.EvtMax = <integer> Component libraries to be loaded ApplicationMgr.DLLs += {<comma separated array of string>} Top level algorithms: “Type/ObjectName” ApplicationMgr.TopAlg += {<comma separated Array of string>}

  34. JobOptions details If you want to run the same algorithm twice with different parameters, give for example ApplicationMgr.TopAlg += {SimpleCellBuilder/CellBuilder1, SimpleCellBuilder/CellBuilder2} CellBuilder1.EThreshold = 0.5; CellBuilder2.EThreshold = 2.0; Comments Preceded by // Include other jobOptions #include “jobOptions_SimpleCell.txt”

  35. Exercises • In all exercise • After each code modification, issue: • goto_build • cmt broadcast gmake • goto_run • athena

  36. Exercise 2a: MsgStream • Print messages with MsgStream • Goto source area and edit SimpleCellBuilder.cxx • Add some prints using different print levels • in initialize(), execute() and finalize() MsgStream log(msgSvc(), name()); log << MSG::INFO << “SimpleCellBuilder” << endreq; • Compile in build area cmt broadcast gmake • Goto run area athena • Change print level in jobOptions.txt file and try again

  37. Declare algorithms properties Declare property variable as data member (*.h) class SimpleCellBuilder : public Algorithm { private: ... double m_EThreshold; string m_CellContainerName; ... }; Declare the property in the Constructor (*.cxx) SimpleCellBuilder::SimpleCellBuilder( <args> ) : <initialization> { declareProperty(“EThreshold”, m_EThreshold); declareProperty(“SimpleCellContainerName”, m_CellContainerName); ... }

  38. Hands On: Set Properties • Set properties in jobOptions file • C++ like syntax • CellBuilder.EThreshold = 0.5; • CellBuilder.SimpleCellContainerName = “MyCellContainer” • <Object name>.<Property name>=<Property value>

  39. Exercise 2b • Add a property to SimpleCellBuilder, namely the name of the SimpleCellContainer. We’ll fill this container in the next part of the exercise • Add a message to print out the name of the container name • Declare a name for the SimpleCellContainer in jobOptions. • Compile and run

  40. Data Access via StoreGate

  41. Objectives • After completing this lesson, you should be able to: • Understand how objects are delivered to user algorithms. • Retrieve objects from the event data store within an algorithm. • Operate on objects collections.

  42. Data Service (3) Request load (2) Search in Store PersistencyService Request dispatcherObjy, ROOT,.. (5) Register Conversion Service (4) Request creation Data Store Converter Converter Converter Converter Loading from Data Store Unsuccessful ifrequested object is not present Algorithm (1) Retrieve object

  43. StoreGate:the Athena Transient Store • Objects of arbitrary type can be posted to SG • no need to inherit from DataObject or ContainedObject (it does not hurt either) • works with STL and STL-like containers (including ObjectVector). Can support custom ones (HepMC) • Type-based hierarchy, type-safe access • no need to specify (and propagate!) object "paths" • object type is primary key, can retrieve all CellCollections or the default one • compiler checks type of retrieved objects • optional "secondary key" (not only strings) allows to identify a specific data object

  44. StoreGate Access • StoreGate, like Gaudi TDS, own recorded objects, The TDS expects full ownership. • Do not destroy existing objects! SG will delete them for you at the right time • It’s not yours! • typically results in an access violation! • the data store is responsible for calling the corresponding delete operator at the end of each event. • "Almost const" access • You can't modify an object you retrieve • compiler error! • you can, when recording an object, allow downstream algos to modify it • use sparingly!

  45. Algorithm SimpleCellBuilder Algorithm SimpleCellNtuple registerObject retrieveObject SimpleCellContainer C C C C C C Transient Data Store The SimpleCellBuilder Example This Example will demonstrate how to store and retrieve data objects from the Transient Data Store.

  46. Registering & Retrieving from TDS via SG • In the initialize step get pointer to the StoreGate service StatusCode sc=service(“StoreGateSvc”, m_storeGate) If (sc.isFailure()) { print error message; return StatusCode::FAILURE;} Declare m_storeGate as a private data member in your header file • To register (record) a SimpleCellContainer: StatusCode sc = m_storeGaterecord(ptr_container, m_CellContainerName); if ( sc != StatusCode::SUCCESS) { print some error message } ptr_container = pointer to the SimpleCellContainer object CellContainerName is a name given to this CellContainer

  47. Registering & Retrieving from TDS via SG • To retrieve this object: Const DataHandle<SimpleCellContainer> cellcontainer; StatusCode sc=m_storeGateretrieve(cellcontainer, m_CellContainerName) Use the DataHandle as a pointer CellContainerName is the given name whileregistering this object

  48. Exercise 2c: • In SimpleCellBuilder you have two data objects: • SimpleCellContainer & SimpleCell • In the initialize pointer to StoreGate Service is already set • In the execute method of SimpleCellBuilder(): • Register the SimpleCellContainer in the TDS • Container name specified in last example 2b in the jobOptions; take that one • Check the return status and issue a success message or an error • Look at the loop that makes SimpleCell and puts them in the container: In particular, look at the use of a gaussian random number generator.

  49. Exercise 2c • You have two algorithms: • SimpleCellBuilder & SimpleCellNtuple • Add SimpleCellNtuple in the program execution • Make sure the CellContainerName in the SimpleCellBuilder and SimpleCellNtup are the same • Run • Start PAW and look at the produced ntuple SimpleCell.ntup

  50. Histograms & Ntuples

More Related