GithubHelp home page GithubHelp logo

dbrzhechko / sframe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zucchett/sframe

0.0 1.0 0.0 7.25 MB

The SFrame Zurich framework for high-level analysis

Python 17.81% Makefile 1.64% Shell 1.43% C++ 78.23% C 0.90%

sframe's Introduction

SFrame Repository

Step-by-step guide to installation

Step 0: ROOT and CMSSW enviroments

Set up the ROOT environment at PSI. The easiest way to do that is to run the cmsenv commend in a previously installed CMSSW release (now using CMSSW_8_0_26_patch1).

source /swshare/psit3/etc/profile.d/cms_ui_env.sh
source $VO_CMS_SW_DIR/cmsset_default.sh
CMSSW_8_0_26_patch1
cd CMSSW_8_0_26_patch1/src
cmsenv

Step 1: Download and setup SFrame

Clone the git repository. Navigate to your work directory, preferably not in a CMSSW release, and run

git clone https://github.com/zucchett/SFrame.git
cd SFrame
git remote add mysframe https://github.com/YOUR-USERNAME/SFrame.git

and enter the SFrame directory. Then, setup the SFrame environment. In the SFrame directory, run the setup.sh script:

cd SFrame/
source setup.sh
cd ..

Step 2: Compile packages

Before running the code, it is necessary to compile all packages. For this run:

./makeAll.sh

you can also go into each directory starting with SFrame and type make Remember that, in case you perform significant modifications to SFrame like adding new variables, adding new methods to classes, adding new packages, it's often useful to clear compiled objects with the make distclean command, and then recompile with make. If you want to clean everything use ./makecleanAll.sh

How to run the code

There are two running modes, locally or with the batch system. The former is used for debugging, checking the output before moving to mass production, and running on small files. The batch mode is used to run on large amount of files such as data and backgrounds. This mode curretly works only on the UZH cluster.

Local mode

Enter your package, and compile it with the make command. Then, set up your configuration xml file. The configuration files are located in the config directory, and include the list of packages to be loaded by SFrame, the package parameters, the verbosity level, and the ntuple file to be read. Once the configuration file is set, and points to a readable rootfile, the code can be run with the command:

cd DM
make
sframe_main config/Configfile.xml

where Configfile.xml is the name of the desired configuration file.

Batch mode

Before running the batch mode, please make sure that the code runs and produce meaningful results. Do not run in batch mode for testing, as it will create a lot of processes. In order to acces files not stored on the tier3, make sure to create a valid grid proxy with the command:

voms-proxy-init --voms cms

The batch jobs are divided in several blocks, to allow some flexibility and run on a subset of the samples (for instance, you may want to run on data alone without processing MC). Each block has a submitBlock.py file, which constains approximately the same information provided by the .xml configuration files. Submit the desired block with the command:

python -u submitSFrame.py -j submitBlock.py --nosandbox --useEnvironment --keepTemp &> logBlock.txt &

where Block replaces the block name. The commands to run all blocks in once is in the submitAll.sh file. Handle with care!

You can check the status of each block with the tail -f logBlock.txt command.

Once the logfiles end with Tschoe! line, the jobs have finished. The temporary outputs can be found in the AnalysisTemp directory, and the merged outputs in the AnalysisOutput directory. If the latter is empty, and the jobs have finished, checking the temporary files and logs is a good strating point to understand what has gone wrong.

Post-processing (old option)

The post-processing script addWeight.py is also included. The simplest post-processing step consists in adding a new variable to the tree containing the weight relatove to each single event, by accounting for the equivalent luminosity and the cross section of the sample. The cross sections are taken from the xsection.py file, which is included by addWeight.py. Control histograms are rescaled as well. If needed, the post-processing step may be extended to perform more complicate operations, such as calculating multivariate discriminants. The script accepts as argument a filter list with the -f filterlist where a string to filter input files may be also provided. The output directory should be also specified with the -o parameter, or the default direcotry should already exist. By default, the post-processing is performed in parallel between different samples, to expolit multi-core machines. The post-processing can be lauched with the command:

python addWeight.py

Post-processing (newer option)

We have added a script (very similar to addWeights.py) that can be run instead and all jobs can be submitted to the batch system.

python submitFriendTrees.py -i INPUT_SFRAME_NTUPLES/ -o testout (-c True)

This code does the same as addWeights, but the default is to just create a friendtree that can be used in addition to the usual tree. If the option -c True is used the the input tree is copied. Running the code over already weighted files will not weight them again, there is a protection against that, however avoid it since it can causer other problems. Working with Friendtrees:

root -l OldTreeFile.root
TTree *T  = (TTree*)_file0->Get("tree")
TFile *_FriendTree = TFile::Open("FriendTreeFile.root")
TTree *FT  = (TTree*)_FriendTree->Get("Ftree")
T->AddFriend(FT)
T->Draw("bla","bli","blub")

Plotting

Once all ntuples are processed, you can plot variables. The tools for this are located in the Plotting directory.

cd Plotting
mkdir plot
python plot.py -v "variable_name as in variables.py" -c "cut name as in selections.py"

sframe's People

Contributors

zucchett avatar clseitz avatar dpinna avatar dbrzhechko avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.