r3 - 25 Aug 2008 - 15:31:19 - MartinZemanYou are here: TWiki  >  ATLAS Web > AtlasSoftware > CosmicsFullChain

Custom Cosmic Muon Simulations in Athena 13.0.10

Customized Athena Full Chain step by step:

I. Simulation

Preparing the lxplus environment

1. Login to lxplus.cern.ch using your credentials.

2. Prepare the necessary directories. Create your CMT_HOME directory for your configuration management (see http://www.cmtsite.org):

> cd $HOME
> mkdir cmt-cosmics

Create your TestArea, where your packages will be installed:

> mkdir testarea
> mkdir testarea/cosmics

3. Download the CMT enviroment to your CMT_HOME. The v1r20p20070208 (an iteration for the v1r20 release) is tested well-working environment.

> cd cmt-cosmics
> source /afs/cern.ch/sw/contrib/CMT/v1r20p20070208/mgr/setup.sh

4. Create the requirements environment for the CMT.

> touch requirements
> mcedit requirements
or use pico or whichever editor you prefer and copy this

#---- CMT HOME REQUIREMENTS FILE ---------------------------------
set   CMTSITE  CERN
set   SITEROOT /afs/cern.ch
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist
macro ATLAS_TEST_AREA /afs/cern.ch/user/m/mzeman/testarea/cosmics

use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)

apply_tag oneTest  # use ATLAS working directory
apply_tag setup    # use working directory
apply_tag 32       # use 32-bit

#----------------------------------------------------------------

5. Configure the CMT to your AFS account (you do this only once per each new CMT_HOME you are using):

> cmt config

6. Logout.

7. Login. Enter your CMT_HOME directory and source the Athena setup with release specifications.

> cd cmt-cosmics
> source setup.sh -tag=13.0.10,runtime

8. Download the packages for cosmics simulation using cmt co command (CMT checkout).

> cd testarea/cosmics
> cmt co -r CosmicGenerator-00-00-24 Generators/CosmicGenerator
> cmt co -r G4AtlasApps-00-02-15 Simulation/G4Atlas/G4AtlasApps
> cmt co -r LArG4HitManagement-00-00-25 LArCalorimeter/LArG4/LArG4HitManagement

Package Description

  • Generators/CosmicGenerator is a generator using a well-tested FORTRAN algorithm which can simulate muons according to real distributions on the surface (Beware! The Generator has reversed coordinates system, but this is fixed in our setup)
  • Simulation/G4Atlas/G4AtlasApps is the main Geant4 simulation package.
  • LArCalorimeter/LArG4/LArG4HitManagement is something obscure.

9. Download the modified G4UserActions? package to your Simulation area
from: /afs/cern.ch/user/j/jez/public/G4PixelCosmics/ or /afs/cern.ch/user/m/mzeman/public/Cosmics/Simulation/G4PixelCosmics/
to: testarea/cosmics/Simulation/

10. Add the following line to the G4AtlasApps? CMT requirements file (do not change anything else).

> cd testarea/cosmics/Simulation/G4Atlas/G4AtlasApps/cmt/
> mcedit requirements

#---- CMT G4AtlasApps REQUIREMENTS FILE -------------------------
.
.
.
use G4AtlasRun...
use G4PixelCosmics G4PixelCosmics-* Simulation=  # <<< this line
.
.
.
#----------------------------------------------------------------

11. Check with CMT broadcast which packages are being used, all of them should be connected.

> cmt broadcast

12. Configure and compile the packages. All the requirements files must be properly configured by now. Execute the following commands within each cmt directory of each package (in this case four times):

> cmt config
> source setup.sh
> gmake

This will create a new directory InstallArea.

You can also use this sophisticated command which does it all for all packages using two threads (so it is faster, harder, scooter): > cmt broadcast cmt config && source setup.sh && gmake -j 3

At this point you should have everything compiled and ready to use. You can verify that the package is compiled correctly if the last line the outputs print out states all ok. You should see this for each package, so in our case four times. If that is not the case, use:

> gmake clean
to delete all package binaries and start over.

13. Copy a sample jobOptions file from G4AtlasApps/share/ to G4Atlas/Apps/run which is the main run directory. It should be some simple file.

> cp testarea/cosmics/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Cosmic.py testarea/cosmics/Simulation/G4Atlas/G4AtlasApps/run/.

14. Modify the file so it uses the G4PixelCosmics package and its text outputs.

Add these declarations to the beginning of your jobOptions. They intertwine the script with our custom G4PixelCosmics package:

#--- Declarations -------------------------------------------
text_output = "text.output.txt"
text_output_floor = "floor.output.txt"
hits_output = "hits.output.txt"
hits_short_output = "hits.short.txt"

Add this line to the end of Simulation flags. This enables the usage of user actions (G4PixelCosmics package):

#--- Simulation flags -----------------------------------------
.
.
.
SimFlags.init_Level.set_Value(1) # enable usage of UserActions

Add this user action configuration to the end of jobOptions:

#==============================================================
# Job configuration (configure the simulation by user actions)
# ***>> Do not add flags or simulation options below this line
#==============================================================
from G4AtlasApps import SimKernel # calls simulation kernel
from G4AtlasApps import AtlasG4Eng # comms betwwen Geant4 & Athena
theApp.initialize()
from G4AtlasApps import PyG4Atlas

MyAction= PyG4Atlas.UserAction( 'G4PixelCosmics','G4PixelCosmics',
       ['BeginOfEvent','EndOfEvent','BeginOfRun','EndOfRun','Step'])

actionProperties={=output_file_name=: text_output ,
       =output_file_name_floor=: text_output_floor ,
       =hits_file_name=: hits_output ,
       =hits_short_file_name= : hits_short_output *

MyAction.set_Properties(actionProperties)

AtlasG4Eng.G4Eng.menu_UserActions.add_UserAction(MyAction)
AtlasG4Eng.G4Eng.init_Simulation(3)


theApp.nextEvent( theApp.EvtMax )
theApp.finalize()
theApp.exit()

#--- End jobOptions.G4Cosmic.py file  -------------------------

Feel free to change the number of events in the AthenaCommon flags as you like. For LXbatch simulations we use about 30000 events which proved stable. On local trying no more than 50 is the thing to do:

athenaCommonFlags.EvtMax=50 # number of events

15. Run Athena and enjoy the text output.

> athena jobOptions.G4Cosmic.bigGun.py |tee output.txt

What to do every time you log on?

Go to your CMT_HOME directory:
> cd cmt-cosmics

Load Athena environment:

> source setup.sh -tag=13.0.10,runtime

Running on lxbatch

NOT FINISHED and probably will not be for some time

In order to simulate larger numbers of events, we need to use the lxbatch because all jobs on lxplus get killed after 40 minutes. This requires modification of our jobOptions:

This submits 10 simulations to the LXbatch. Make sure you have enough disk space or the runs will fail. > fs lq

One successful run text file outputs has about 10 MB.

All the ROOT files are saved on CASTOR which can be listed by:

> rfdir /castor/cern.ch/user/m/mzeman

% RECONSTRUCTION % source /afs/cern.ch/sw/contrib/CMT/v1r20p20080222/mgr/setup.sh %cmt co -r InDetCosmicRecExample? -00-03-62 %bacha castor 'afs' % DetDescrTag? = 'ATLAS-CommNF-02-00-00' % InputFile? = '/afs/cern.ch/user/j/jez/scratch0/newCosmics13/Simulation/G4Atlas/G4AtlasApps/run/digiID.pool.root' % athena ../share/InDetCosmicRec_topOptions.py % JiveXML? = True

-- MartinZeman - 24 Jul 2008

Show attachments Hide attachments
Topic attachments
I Attachment Action Size Date Who Comment
elsejob CosmicCavern.job manage 1.4 K 31 Jul 2008 - 22:31 MartinZeman Batch Simulation Job
elsejob CosmicDigi.job manage 0.7 K 31 Jul 2008 - 22:31 MartinZeman Batch Digitization Job
elsejob CosmicEnd.job manage 0.4 K 31 Jul 2008 - 22:32 MartinZeman Batch Simulation Job 2
elsejob CosmicReco.job manage 0.6 K 31 Jul 2008 - 22:32 MartinZeman Batch Reconstruction Job
elseTeX CosmicsFullChain.TeX manage 6.6 K 24 Jul 2008 - 19:13 MartinZeman LaTeX? modular
shsh SubmitDigitization.sh manage 1.9 K 31 Jul 2008 - 22:32 MartinZeman bsub digitization
shsh SubmitReconstruction.sh manage 0.7 K 31 Jul 2008 - 22:33 MartinZeman bsub reconstruction
shsh SubmitSimulation.sh manage 1.8 K 31 Jul 2008 - 22:33 MartinZeman bsub simulation
shsh TruncateDigitization.sh manage 1.0 K 31 Jul 2008 - 22:33 MartinZeman Truncate Digitization Outputs
shsh TruncateSimulation.sh manage 1.0 K 31 Jul 2008 - 22:33 MartinZeman Truncate Simulation Outputs
shsh ZipDigitization.sh manage 1.0 K 31 Jul 2008 - 22:34 MartinZeman Digitization Zip and Send to Castor
shsh ZipSimulation.sh manage 1.0 K 31 Jul 2008 - 22:34 MartinZeman Simulation Zip and Send to Castor
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright &Š by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback