Sharing protected information

This site is open only to members who have access to ATLAS Protected: UMassGroupProtectedTWiki


Before you begin, download the following file (attached to this wiki):

  • requirements

This whole wiki is set up to run in 14.2.10. I've set up my work environment in my home directory on lxplus like this:

> mkdir testarea
> cd testarea
> mkdir 14.2.10
> cd 14.2.10

This is where you will run root from, for release 14.2.10.
Copy the requirements file to this directory, and then:

> source /afs/
> cmt config

The above only needs to be done once. However, every time a new terminal window is opened:

> source -tag=14.2.10,32,opt
> source $AtlasArea/AtlasOfflineRunTime/cmt/

How to generate events using transformations

For the example, download the following file (attached to this wiki):

  • (for some reason when this was uploaded to the TWiki, it wanted to rename it ""...when you download it, rename it back to "")

I would make a subdirectory to run in (the job creates lots of extra files)

  • copy to the run directory

Set up the work area for 14.2.10:

> source -tag=14.2.10,32,opt
> source $AtlasArea/AtlasOfflineRunTime/cmt/

To find a list of all the transformations, you can do

> trf_ls

The one we will use for the 10 TeV beam to generate events and run them through Atlfast is

To see what any of the transformations take as arguments, use the -h option:

> -h

For this transformation, you need:

    1 runNumber (int) # each run number corresponds to one physics process
    2 firstEvent (int) # number of the first event in the output data file
    3 maxEvents (int) # Maximum number of events to process
    4 randomSeed (int) # random seed for physics generators
    5 jobConfig (list) # jobOptions fragment containing the physics and the configuration settings
    6 outputEvgenFile (str) # Output file that contains generated events
    7 outputAODFile (str) # Output file that contains AOD's
    8 ntupleFile (str) # Output file that contains ntuples.
  [ 9 histogramFile] (str) default='NONE' # Output file that contains histograms.
  [10 inputGeneratorFile] (str) default='NONE' # Input file used by the particle generator to generate events

Keep the name of the job options in each file name, with "AOD" or "NTUP"...etc. Note that with the transformations, the minimum number of events is 5000, and the maximum is 9999.

> 105145 1 5000 932847 MC8.105145.PythiaZmumu120cutoff.gen.01.root MC8.105145.PythiaZmumu120cutoff.AOD.01.root MC8.105145.PythiaZmumu120cutoff.NTUP.01.root

After the generation/Atlfast has finished, it's good to check the following things:

- Find the cross-section
> grep -A 10 "cross" csc_evgen08.log. There will be a line which says MetaData: cross-section (nb) 0.0126018= or something similar. This value should be recorded.

- Validate the event generation
> grep -A 2 "ERROR" csc_evgen08.log. There should not be many momentum or energy imbalances (one or two is ok, according to Monte Carlo people).

For more information on the transforms, see:

There is also a list of all the official job options on cvs:

How to set up Athena Root Access

Before you begin, copy the following file (attached to this wiki):

  • (same thing as with the other python file in the previous section...uploaded here as, needs to be renamed to

Set up work area:

> source -tag=14.2.10,32,opt
> source $AtlasArea/AtlasOfflineRunTime/cmt/

You are ready to run the atlas software. Check out packages as on the Athena Root Access TWiki:

Check to see that you now have a directory called "PhysicsAnalysis".

Next you need to compile all of the packages:

> cd PhysicsAnalysis/AthenaROOTAccess/cmt
> cmt config
> make

do the same for the other packages (AthenaROOTAccessExamples..and whatever else was checked out)

> cd ~/testarea/14.2.10

The file needs to be edited to tell it where your AOD data is stored. Then you can start root:

> root -l

within root, do:

> TPython::Exec("execfile('')")
> CollectionTree_trans = (TTree *)gROOT->Get("CollectionTree_trans")
> TriggerExample blah
> blah.main(CollectionTree_trans)

The TriggerExample class is defined in
and its header file is in

Also notice that in PhysicsAnalysis/AthenaROOTAccessExamples/AthenaROOTAccessExamples, you need two files:

  • selection.xml
  • AthenaROOTAccessExamplesDict.h

The source files are listed in AthenaROOTAccessExamplesDict.h, and the classes are in selection.xml. If you write new code, these both need to be edited (see the next example)

Creating a new package for Athena Root Access and dimuon mass example

Before you begin, copy the following files (attached to this wiki):

  • DimuonMass.cxx
  • DimuonMass.h
  • selection.xml
  • DimuonMass_Dict.h
  • requirements2

This should work out of the box with Atlfast AODs produced in the "How to generate events using transformations" section. For running on other AODs (full simulation, for example), DimuonMass.cxx will need to be edited to change the name of the muon container.

We'll start by creating a new package, named DimuonMass:

On lxplus:

> cd ~/testarea/14.2.10
> source -tag=14.2.10,32,opt
> source $AtlasArea/AtlasOfflineRunTime/cmt/
> cmt create DimuonMass DimuonMass-00-00-01 PhysicsAnalysis
> cd PhysicsAnalysis/DimuonMass/
> mkdir DimuonMass (yes, another one)
> cd DimuonMass

  • copy DimuonMass.h to this directory
  • copy DimuonMass_Dict.h to this directory
  • copy selection.xml to this directory

DimuonMass_Dict.h is where the header files in the DimuonMass package are taken from. If you decide to write more code in this same package, you will need to edit this file and add another line with the header file name.

You can also look at selection.xml. This is where the class names are stored, for every class in the package. In DimuonMass.h, there are three classes: DimuonMass, DimuonMassLimits, and DimuonMassHists. Any other classes defined in other code written in the DimuonMass package will need to be defined in selection.xml.

> cd ../src/

copy DimuonMass.cxx to this directory

> cd ../cmt/

  • copy requirements2 to this directory

> mv requirements2 requirements (had to rename it so that I could attach two versions on this wiki)

> cmt config
> make

Now you should have the package working.

After every edit to the source file, you need to recompile in the cmt directory. To do this faster, type

> make QUICK=1

To run in root, do the same as before, only with "DimuonMass blah" (as opposed to the trigger example):

> TPython::Exec("execfile('')")
> CollectionTree_trans = (TTree *)gROOT->Get("CollectionTree_trans")
> DimuonMass blah
> blah.main(CollectionTree_trans)

Making a simple Ntuple from ARA using NtupleDumper.cxx

Before you begin, you need to have Athena Root Access set up as above in the DimuonMass example, and download the following files (attached to this wiki):

  • NtupleDumper.cxx
  • NtupleDumper.h

Right now, the NtupleDumper code makes a vector of muon candidates from an AOD container, and also creates dimuon candidates out of two of the muons (there isn't anything in the code yet to choose the best two muons to make the dimuon candidate).

Put NtupleDumper.cxx in PhysicsAnalysis/DimuonMass/src/, and NtupleDumper.h in PhysicsAnalysis/DimuonMass/DimuonMass/

As in the previous section, you need to edit two files:

  • To DimuonMass_Dict.h, add the line:
     #include "DimuonMass/NtupleDumper.h" 
  • To selection.xml, add the line:
     <class name="NtupleDumper" /> 

Compile the code:

> cd ../cmt/ 
> make QUICK=1

To run the code, it will be the same as in the previous example, with one exception...since v5.15, ROOT doesn't recognize objects of the form vector. You have to explicitly tell it what it is:

> TPython::Exec("execfile('')")
> CollectionTree_trans = (TTree *)gROOT->Get("CollectionTree_trans")
> NtupleDumper blah
> gROOT->ProcessLine("#include <vector>")
> blah.main(CollectionTree_trans)

The output will be a file named "mu_ntuple.root" (you can change this in the NtupleDumper.cxx file). To view the contents of the ntuple, you can open a browser (still in ROOT):

> TFile f("mu_ntuple.root")
> new TBrowser

Major updates:
-- EmilyThompson - 01 Nov 2008
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatcxx DimuonMass.cxx r1 manage 4.7 K 2008-10-31 - 11:50 EmilyThompson  
Header fileh DimuonMass.h r1 manage 0.9 K 2008-10-31 - 11:50 EmilyThompson  
Header fileh DimuonMass_Dict.h r1 manage 0.1 K 2008-10-31 - 11:51 EmilyThompson  
Texttxt r1 manage 3.2 K 2008-10-31 - 13:30 EmilyThompson  
Unknown file formatcxx NtupleDumper.cxx r1 manage 5.6 K 2009-02-24 - 16:39 EmilyThompson  
Header fileh NtupleDumper.h r1 manage 0.3 K 2009-02-15 - 15:56 EmilyThompson  
Unknown file formatext requirements r1 manage 0.3 K 2008-10-31 - 11:51 EmilyThompson  
Unknown file formatext requirements2 r1 manage 1.0 K 2008-10-31 - 11:51 EmilyThompson  
XMLxml selection.xml r1 manage 0.1 K 2008-10-31 - 11:52 EmilyThompson  
Texttxt r1 manage 1.3 K 2008-10-31 - 11:53 EmilyThompson  
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2010-06-02 - EmilyThompson
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback