TWiki
>
Computing Web
>
Ganga
>
OxfordGangaTutorial
>
OxfordGangaTutorialAtlasSession1
(13 Dec 2008,
_47C_61UK_47O_61eScience_47OU_61Birmingham_47L_61ParticlePhysics_47CN_61mark_32slater
?
)
(raw view)
E
dit
A
ttach
---+ Introduction to Athena and the Atlas Computing Model This session will introduce Athena and how to do a basic analysis. It will not go into this in depth at all as that is beyond the scope of the tutorial and so it is highly recommended to go to one of the rolling ATLAS CERN tutorials or the UK tutorial at the end of January. ---+++ Setting up Athena Though it is easy to setup the Athena environment at Oxford to run 'vanilla' Athena, to demonstrate building and altering the UserAnalysis package, we need to do things slightly differently. Note that many people have their own ways of doing this and maybe combine the actions below into a script or two (see athena_install.sh and athena_local.sh in my user area!) but essentially, these steps have to be followed one way or another and it may be instructive to go through it the long way first so you have a better idea what everything means! To start with, we must setup a cmt directory. CMT is the package and environment manager and this directory will hold your personal CMT settings: <verbatim> cd $HOME mkdir cmthome cd cmthome </verbatim> Now within this directory, we will create a requrements file that holds your settings. Copy the following into a file called 'requirements': <verbatim> set CMTSITE STANDALONE set SITEROOT /opt/atlas_software/SL4/i386/14.2.10_release/ macro ATLAS_DIST_AREA /opt/atlas_software/SL4/i386/14.2.10_release/ macro ATLAS_TEST_AREA /home/slater/Athena use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA) </verbatim> Note that you should change the ATLAS_DIST_AREA to the version that you wish to run on and ATLAS_TEST_AREA to where you want to run. We can now properly setup cmt using these requirements: <verbatim> source /opt/atlas_software/SL4/i386/14.2.10_release/CMT/v1r20p20080222/mgr/setup.sh cmt config </verbatim> Finally, we can setup athena. This is the only step that needs to be done each time you logon: <verbatim> cd $HOME source cmthome/setup.sh -tag=14.2.10,32,setup </verbatim> Note that you may get some warnings about the test area not being present, but that will be fixed as we proceed through the session. ---+++ Running Athena Now that athena is setup, we can try to run a basic 'Hello World' example in the straight 'vanilla' mode. To start with, we need to add the appropriate directories: <verbatim> mkdir -p Athena/AtlasOffline-14.2.10/run cd Athena/AtlasOffline-14.2.10/run </verbatim> We will now download the job options for the Hello World example. The Job Options file is a python based configuration file that 'steers' Athena and can be used to control the modules used, algorithms run, settings applied, etc. To download into the run directory, do the following: <verbatim> get_files -jo HelloWorldOptions.py </verbatim> And now we invoke Athena using these job options: <verbatim> athena HelloWorldOptions.py </verbatim> If all is well, you should see a lot of output showing that Athena ran successfully! ---+++ Downloading and Modifying External Packages Now that we have athena running, we can move on to a more realistic situation. For this, we will use the 'UserAnalysis' package which is provided as a framework for a typical analysis. Essentially, it will run over the given file and for each event, pass through the 'execute' method. In here you can access the information provided by the event and save or plot what you are interested in in a ROOT file. The first step to this is to download the UserAnalysis package. To do this, run the following (noting to change the CERN userid): <verbatim> export CVSROOT=":ext:mslater@isscvs.cern.ch:/atlascvs" export CVS_RSH="ssh" cd $TestArea cmt co -r UserAnalysis-00-13-03 PhysicsAnalysis/AnalysisCommon/UserAnalysis </verbatim> If you don't have a CERN account, then copy 'PhysicsAnalysis.tar.gz' from my userarea instead: <verbatim> cp /home/slater/PhysicsAnalysis.tar.gz . tar -zxf PhysicsAnalysis.tar.gz </verbatim> Again, it is worth noting that this version of the UserAnalysis has been tagged for this version of Athena. Be careful blindly downloading packages from CVS as they could be incompatible with the version of Athena you are using. Next, we need to setup and build the package: <verbatim> cd $TestArea/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt cmt config source setup.sh cmt make </verbatim> The package will now build and be installed in your own Install Area. The libraries placed here will override those standard ones. To check everything is still OK, we will run over an AOD file in my userarea using the basic AnalysisSkeleton job options: <verbatim> cd ../run ln -s /home/slater/mc08.105003.pythia_sdiff.recon.AOD.e344_s456_r545/AOD.026664._00133.pool.root.1 AOD.pool.root cp ../share/AnalysisSkeleton_topOptions.py . athena AnalysisSkeleton_topOptions.py </verbatim> Again, if all is well, you should see a lot of Athena output ending with 'successful run'. ---+++ Modifying the Package We will now make some typical alterations to the UserAnalysis code to output some truth information about the MC sample. The types of changes you want to do will obviously be very dependant on the analysis you're doing but this will hopefully give you an idea! Firstly, add the following in the various function definitions within src/AnalysisSkeleton.cxx: <verbatim> StatusCode AnalysisSkeleton::CBNT_initialize() { ... // final state info addBranch("NFinal", m_aan_FinalNum, "NFinal/i"); addBranch("FinalEnergy", m_aan_FinalEnergy); addBranch("FinalPt", m_aan_FinalPt); addBranch("FinalPx", m_aan_FinalPx); addBranch("FinalPy", m_aan_FinalPy); addBranch("FinalPz", m_aan_FinalPz); addBranch("FinalEta", m_aan_FinalEta); addBranch("FinalID", m_aan_FinalID); ... </verbatim> <verbatim> StatusCode AnalysisSkeleton::CBNT_clear() { ... m_aan_FinalNum = 0; m_aan_FinalEnergy->clear(); m_aan_FinalPt->clear(); m_aan_FinalPx->clear(); m_aan_FinalPy->clear(); m_aan_FinalPz->clear(); m_aan_FinalEta->clear(); m_aan_FinalID->clear(); ... </verbatim> <verbatim> StatusCode AnalysisSkeleton::CBNT_execute() { ... // get the MC particle store from storegate const TruthParticleContainer* mcpartTES = 0; sc=m_storeGate->retrieve( mcpartTES, m_truthParticleContainerName); if( sc.isFailure() || !mcpartTES ) { mLog << MSG::WARNING << "No AOD MC truth particle container found in TDS" << endreq; return StatusCode::SUCCESS; } // now loop ovder the particles and store the appropriates TruthParticleContainer::const_iterator it; for (it = mcpartTES->begin(); it != mcpartTES->end(); it++) { int bc = (*it)->genParticle()->barcode(); int id = (*it)->pdgId(); double e = (*it)->e(); double pt = (*it)->pt(); double px = (*it)->px(); double py = (*it)->py(); double pz = (*it)->pz(); double eta = (*it)->eta(); bool is_exit_p = false; // don't include rebound proton as final state particle if ((id == 2212) && (*it)->hasMother((PDG::pidType) 2212) && ((*it)->mother()->pdgId() == 2212) && (*it)->mother()->hasMother((PDG::pidType)2212) && ((*it)->mother()->mother()->pdgId() == 2212) && (!(*it)->mother()->mother()->hasMother((PDG::pidType)2212))) { is_exit_p = true; } // check for final state particles - note the cut on geant created particles if (((*it)->genParticle()->status() == 1) && (bc < 10000) && !is_exit_p) { m_aan_FinalNum++; m_aan_FinalEnergy->push_back( e ); m_aan_FinalPt->push_back( pt ); m_aan_FinalPx->push_back( px ); m_aan_FinalPy->push_back( py ); m_aan_FinalPz->push_back( pz ); m_aan_FinalEta->push_back( eta ); m_aan_FinalID->push_back( id ); } } ... </verbatim> Finally, add the following in the 'private' area of the header (UserAnalysis/AnalysisSkeleton.h) <verbatim> ... // My added stuff int m_aan_FinalNum; std::vector<double>* m_aan_FinalEnergy; std::vector<double>* m_aan_FinalPt; std::vector<double>* m_aan_FinalPx; std::vector<double>* m_aan_FinalPy; std::vector<double>* m_aan_FinalPz; std::vector<double>* m_aan_FinalEta; std::vector<int>* m_aan_FinalID; ... </verbatim> We're now ready to compile the changes. As before, go into cmt directory in the package and run the make command: <verbatim> cmt make </verbatim> Now, run Athena as before and hopefully, when you check the ROOT file output, the Final State particle information should be present. ---+++ Every Time You Logon Just to clarify, you don't need to go through all the above each time you logon! Assuming you have a fresh shell, you can run the job above doing the following: <verbatim> source cmthome/setup.sh -tag=14.2.10,32,setup cd $TestArea/PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt source setup.sh cd ../run athena AnalysisSkeleton_topOptions.py </verbatim>
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r2
<
r1
|
B
acklinks
|
V
iew topic
|
WYSIWYG
|
M
ore topic actions
Topic revision: r2 - 13 Dec 2008
-
_47C_61UK_47O_61eScience_47OU_61Birmingham_47L_61ParticlePhysics_47CN_61mark_32slater
?
Computing
Log In
Computing Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
ALICE
ATLAS
BILPA
CALICE
Computing
General
LHCb
LinearCollider
Main
NA62
Publish
Sandbox
TWiki
Welcome
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback