Running the VH analyses
Getting prepared
Here is how to use the software package Adrian wrote and put in svn as "HiggsAnalysis" in order to do the VH analyses with the help of the GlaNp package. We plan to check out the HiggsAnalysis package.
First you have to checkout and build the latest versions of the GlaNtp and HiggsAnalysis packages.
GlaNtp:
AdrianBuzatuZHFrameworkGlasgowGlaNtpCheckout
HiggsAnalysis:
AdrianBuzatuZHFrameworkGlasgowGlaNtpHiggsAnalysisCheckout
Then we define the variables in a new exterm.
ssh -Y ppepc137.physics.gla.ac.uk
Then open an xterm terminal.
xterm
Go to the HiggsAnalysis package
Do you want to run a tagged version of HiggsAnalysis? Typically users that are not developers of HiggsAnalysis want that. Go the tagged version you already have installed.
cd $HOME/public_ppe/HiggsAnalysis/HiggsAnalysis-00-00-03
Do you want to run the trunk (head) version of HiggsAnalysis? Typically developers of HiggsAnalysis want that (Adrian was the creator of this package and always uses this, so the tagged will not be the latest version, but the latest stable version).
cd $HOME/public_ppe/HiggsAnalysis/trunk
Setup GlaNtp and others (short practical version)
Do you want to setup a tagged version of GlaNtp? Typically users that are not developers of GlaNtp want that. Set up the tagged version you already have installed. The tag version is hard coded in the file.
source setupTag.sh
Do you want to set up the trunk (head) version of GlaNtp? Typically developers of GlaNtp want that (Adrian was has added some executables in the RootUtil/test folder of GlaNtp, so Adrian uses this).
source setupTrunk.sh
Be careful to always source and never execute these scripts. If you execute them, then the setup is done only during running and the new environment variables do not exist afterwards. To check that they do, show the directory where GlaNtp is taken from, check for example that ROOT is now defined and one command from GlaNtp is accessible to you.
echo "GLANTPDIR=$GLANTPDIR"
which root
which CheckEntriesrv5
Setup GlaNtp and others (long fancy useless version)
Skip this section if you did the section above with setting GlaNtp in the quick way.
Define the environment values we will use:
export WORKING_AREA=$HOME/public_ppe
export PACKAGE_GN=GlaNtpPackage
export FOLDER_GN=$WORKING_AREA/$PACKAGE_GN
export PACKAGE_GN_TAG="00-00-66"
or
export PACKAGE_GN_TAG="h"
export FOLDER_GN_TAG=$WORKING_AREA/$PACKAGE_GN/$PACKAGE_GN_TAG
Set up the already checked out version of GlaNtp:
source $HOME/public_ppe/scripts/setup_glantp.sh -v $PACKAGE_GN_TAG
Check is to see if you can access one of the commands in GlaNtp
which CheckEntriesrv5
Now that we are done with setting up GlaNtp, we define the environment variables for the package HiggsAnalysis.
export PACKAGE_HA=HiggsAnalysis
export FOLDER_HA=$WORKING_AREA/$PACKAGE_HA
export PACKAGE_HA_TAG="00-00-03"
export FOLDER_GN_TAG=$WORKING_AREA/$PACKAGE_GN/$PACKAGE_GN_TAG
or
export PACKAGE_HA_TAG="h" (not used anywhere, but for consistency with GlaNtp)
export FOLDER_HA_TAG=$WORKING_AREA/$PACKAGE_HA/trunk
Now we are ready to do the analyses, so we go to the appropriate HiggsAnalysis folder, from where we run.
cd $FOLDER_HA_TAG
To check that we are indeed here
pwd
Thin flatuples independently of other scripts
First produce a new flattuple that keeps the physics and global trees but only for the events that pass the selections described in the file .txt.
cd $HOME/public_ppe/HiggsAnalysis/trunk
ThinFlattuplerv5 /afs/phas.gla.ac.uk/data/atlas/abuzatu06/fromMike/flattuples/WH120_NONE_FlatTuple_AtlasHbbTuple.root /afs/phas.gla.ac.uk/data/atlas/abuzatu06/fromMike/flattuples2/WH120_lvbb.root steerFiles/Sample_lvbb.txt 0 0
Then read the number of entries in that file.
GetEntriesrv5 /afs/phas.gla.ac.uk/data/atlas/abuzatu06/fromMike/flattuples2/WH120_lvbb.root physics
Run on flattuples
Once Mike gives us flattuples from the grid using AtlasHbb, there are several stages to run, but all use the same script "runOnFlattuples" that takes as a command-line argument the action that we want to do.
cd $HOME/public_ppe/HiggsAnalysis/trunk
First, we need to correct the global tree information, which for data is setting all values to 1, and for MC is setting NGen to the total of all the files produced for that process.
./runOnFlattuples.sh WenuHbb MCtest 0 0 0 0 /afs/phas.gla.ac.uk/data/atlas/abuzatu06/fromMike/flattuples 1 6 globalfix
Then if you want to update the global tree for example by changing your selection for a certain region (cutmask and invertword values from the globaldata tree) you should run the following command. But bear in mind that what you change too is hard coded in GlaNtp. You have to change there, then recompile GlaNtp, then you can run. This is dirty, but I did not have time to code more. However, it is flexible enough to allow us to change the selection criteria quickly, recompile and then run again.
cd $HOME/public_ppe/GlaNtpPackage/GlaNtpSVNh/trunk/RootUtil/test
emacs GlobalTreeVHv16Update.cc
look for "if(false)" statements, make changes inside and set them to true, save the file
Now recompile and the new executable is accesible for us to use in the HiggsAnalysis side.
(cd .. ; make)
Now we can run the command.
./runOnFlattuples.sh WenuHbb MCtest 0 0 0 0 /afs/phas.gla.ac.uk/data/atlas/abuzatu06/fromMike/flattuples 1 6 globalupdate
Then open the .root file and look at the globaldata and it will have different cut mask and invert word.
root.exe /afs/phas.gla.ac.uk/data/atlas/abuzatu06/fromMike/flattuples/flattuple_WH120-1.root
globaldata->Show(0)
Now we want to thin the flattuples according to the selection that we desire. This will mean that the globaldata tree will be kept unchanged, but the physics tree will contain only the events that pass the event selection, and for each such event all the branches and leaves of the initial tree will be kept. For this we run
./runOnFlattuples.sh WenuHbb MCtest 0 0 0 0 /afs/phas.gla.ac.uk/data/atlas/abuzatu06/fromMike/flattuples 1 6 thinselection
Implementation in progress ...
Run templates
Edit the file doRunTemplates.sh to run the test files for data and MC and run.
./doRunTemplates.sh
You should see the log files in the folder "logs" and the output .root template files in the folder "templates". The input files are the thinned flattuples stored by Adrian. The path is in this script.
I will add here the rest of the commands: we can manipulate the flattuples in different ways, we can make the stacked plots after the flattuples.
Back to mother page:
AdrianBuzatuZHFrameworkGlasgowGlaNtp.
--
AdrianBuzatu - 11-Jul-2012