Difference between revisions of "GoodRunsList in AMA"
Line 44: | Line 44: | ||
=== 3: Calculate the luminosity === | === 3: Calculate the luminosity === | ||
+ | |||
+ | ==== Check if the lumi info is present ==== | ||
Even though you end up with only the events of interest, you need to know how many you removed in order to do the luminosity calculation correctly. This information is saved in two ways. A new XML file is dumped by AMA (something like luminosity_grl_*.xml). This can be used as input to iLumiCalc.exe. Secondly, if you dumped an ntuple, a TObjString is attached to the userinfo that contains the same info as the XML file. | Even though you end up with only the events of interest, you need to know how many you removed in order to do the luminosity calculation correctly. This information is saved in two ways. A new XML file is dumped by AMA (something like luminosity_grl_*.xml). This can be used as input to iLumiCalc.exe. Secondly, if you dumped an ntuple, a TObjString is attached to the userinfo that contains the same info as the XML file. | ||
To test the latter, open your ntuple in root and do: | To test the latter, open your ntuple in root and do: | ||
Line 50: | Line 52: | ||
root [2] grlString | root [2] grlString | ||
</pre> | </pre> | ||
+ | Both the ntuple and the output XML file can be used to do the calculation. | ||
+ | |||
+ | ==== Run iLumiCalc ==== | ||
+ | Back in the shell, do this to avoid problems with accessing the Cool database: | ||
+ | <pre>export CORAL_DBLOOKUP_PATH=/data/atlas/offline/db/XMLConfig</pre> | ||
+ | Otherwise you'll get this error: | ||
+ | <pre>--- <ERROR> CoolQuery : Problem opening CORAL database: Cannot connect to or create COOL database</pre> | ||
+ | |||
+ | Now do: | ||
+ | <pre>iLumiCalc.exe --root=summary/STRUCTNTUP_data1_data.conf_nEvts_100.root --tree=tree | ||
+ | </pre> | ||
+ | or: | ||
+ | <pre>iLumiCalc.exe -x nameofthefile.xml</pre> | ||
+ | Note that this should be the OUTPUT xml file, not the one you used in AMAAthena_jobOptions_new_GRL.py! |
Revision as of 17:14, 23 March 2010
Introduction
(still to be validated)
This page explains how to use the GoodRunsLists within AMAAthena. GoodRunsLists make it possible to select specific datasets AND lumiblocks satisfying detector and data quality constraints. A more general Atlas tutorial can be found here: GRL Tutorial.
Prepare
There are a few steps to make, in order to get it all working.
1: Get an XML file
First of all, you need an XML file with the datasets and lumiblocks you want to run over. To make one yourself, go to Atlas Run Query and enter a query containing all DQ flags you need/like. This page has lots of examples and help functions to assist in forming a query.
Press Show Runs, wait for it... and inspect the results. On the bottom of the page you can choose to view in 'pretty mode', 'python dictionary', 'Root tree', but we need to dump it as an XML file. Choose this one. Now you have your XML file, check if it looks ok. (Obviously, it is also possible to take the XML file supplied by your group, Atlas or anyone else you assume knows it all.)
2: Edit the AMAAthena jo
The idea is now, to let AMAAthena only run over events that are in the selected lumiblocks and datasets, and skip the rest. This is especially nice when you are running over millions of events. Make sure you have an updated version of AMA (at least AMAAthena-00-01-59), by doing for example 'svn update'. Compile if necessary, but check explicitly that in AMAAthena/share there is a file called AMAAthena_jobOptions_new_GRL.py.
Open this file and modify these two lines, such that they reflect your xml file: 1. GoodRunsListSelectorTool.GoodRunsListVec = [ 'GRList_dec09_stablebeams_CaloGreen.xml' ] 2. seq.GRLTriggerAlg1.GoodRunsListArray = ['GRList_dec09_stablebeams_CaloGreen'] (note that this MUST be equal to the xml file without the extension.
Run locally...
Make sure you have sample definition that points to a data file (or copy this one as an example)
TITLE: data /data/atlas3/users/imussche/ data09_900GeV.00142383.physics_MinBias.merge.AOD.f196_m325/data09_900GeV.00142383.physics_MinBias.merge.AOD.f196_m325._lb0086-lb0095.1
(And a config file that works, but surely you can find one yourself :).
Then do for example:
AMAAthenaDriver data 1000 ConfigFile=data.conf TRIG,DATA,GRL
Note 1: GRL calls the joboptions you just edited.
If you dump an ntuple, and for example make this histogram:
root> tree->Draw("lumiBlock")
you will see that really only the lumiblocks you wanted are in. Now you can move to Chapter 3 to calculate the effective luminosity.
... or use Ganga and go all the way
This is much nicer of course, since you don't want to download all the datasets in reality, but let ganga do the work. This I still need to test.
3: Calculate the luminosity
Check if the lumi info is present
Even though you end up with only the events of interest, you need to know how many you removed in order to do the luminosity calculation correctly. This information is saved in two ways. A new XML file is dumped by AMA (something like luminosity_grl_*.xml). This can be used as input to iLumiCalc.exe. Secondly, if you dumped an ntuple, a TObjString is attached to the userinfo that contains the same info as the XML file. To test the latter, open your ntuple in root and do:
root [0] TObjString* grlObjString = (TObjString*)tree->GetUserInfo()->At(0) root [1] TString grlString = grlObjString->GetString() root [2] grlString
Both the ntuple and the output XML file can be used to do the calculation.
Run iLumiCalc
Back in the shell, do this to avoid problems with accessing the Cool database:
export CORAL_DBLOOKUP_PATH=/data/atlas/offline/db/XMLConfig
Otherwise you'll get this error:
--- <ERROR> CoolQuery : Problem opening CORAL database: Cannot connect to or create COOL database
Now do:
iLumiCalc.exe --root=summary/STRUCTNTUP_data1_data.conf_nEvts_100.root --tree=tree
or:
iLumiCalc.exe -x nameofthefile.xml
Note that this should be the OUTPUT xml file, not the one you used in AMAAthena_jobOptions_new_GRL.py!