Skip to content

Instantly share code, notes, and snippets.

View KonstantinSchubert's full-sized avatar

Konstantin Schubert KonstantinSchubert

View GitHub Profile
### Keybase proof
I hereby claim:
* I am konstantinschubert on github.
* I am konschubert (https://keybase.io/konschubert) on keybase.
* I have a public key ASDtBziP8J2GJT26hOdUi_opo5r-fKNBueNIVBmoswKChgo
To claim this, I am signing this object:
total 3774
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:04 conf-00000023-2f8e-4b77-a5e6-d64e18ba7501
drwxr-xr-x. 2 koschube z5 2048 Jul 7 13:58 conf-001ab14a-32b9-49e9-b805-585b33dd992e
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:00 conf-0022a623-b316-4202-896f-0b0775568acd
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:07 conf-00655cd3-e9b9-4366-87a5-7a8cf582281f
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:00 conf-006eb619-4756-44a9-9308-ec0bc7fa20f4
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:09 conf-00abe28d-6750-4bf4-9569-cb10d1c74acb
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:10 conf-00f16e68-fdb1-4eb1-b567-07d6cc669dcb
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:04 conf-0104aede-f3f6-41a9-9db1-8e712e31a440
drwxr-xr-x. 2 koschube z5 2048 Jul 7 14:01 conf-01174e17-648f-4db9-aa6a-4e415f290c70
@KonstantinSchubert
KonstantinSchubert / fit_extended.py
Created April 28, 2016 14:47
setNormRange does not work when doing an extended fit apparently!
## setNormRange does not work when doing an extended fit apparently!
import scipy.integrate
import numpy
import matplotlib.pyplot as plt
from ROOT import *
gErrorIgnoreLevel = kInfo;
points = [ 4630.206, 4905.73 , 5030.952, 4475.197, 4425.941, 4808.518, 4500.441, 4647.756, 4629.322, 5752.579, 4847.882, 6035.395, 4432.979, 4382.774, 4591.621]
ranges = [(4360.,5020.),(5626,6360)]
@KonstantinSchubert
KonstantinSchubert / roofit_problem
Last active January 26, 2016 14:32
A short minimal example showcasing an issue with RooFit. You need ROOT with pyroot to run it.
import scipy.integrate
import numpy
import matplotlib.pyplot as plt
points = [ 4425.941, 4369.934, 5903.859, 4432.979, 6035.395, 4685.236, 4382.774, 4532.092, 4591.621, 4629.322, 4739.585, 4529.45, 4500.441, 5752.579]
ranges = [(4367.,5020.),(5626,6366)]
def plot(exponent):
_, borders, _ = plt.hist(points)
@KonstantinSchubert
KonstantinSchubert / make_root_dockerfiles.py
Last active January 13, 2016 16:41
Script that generates Dockerfiles containting an ubuntu 14.04 with different versions of CERN's ROOT. The Dockerfiles are stored in this repository: https://github.com/KonstantinSchubert/ROOT_Dockerfiles And the resulting images can be found on https://hub.docker.com/r/schubertkonstantin/cern_root/
import subprocess
import os
import re
dockerfile_template = \
"""FROM schubertkonstantin/root:dependencies
MAINTAINER Konstantin Schubert <schubert.konstantin@gmail.com>
# based on a Dockerfile by Sebastian Neubert
@KonstantinSchubert
KonstantinSchubert / layout
Created June 28, 2015 15:38
layout xml for activity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/enter_workload">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@KonstantinSchubert
KonstantinSchubert / MakePIDCorrection.py
Last active August 29, 2015 14:14
Suggested speed improvements for the MCResampling tool
#################################################################################
###
###
###
#################################################################################
from PIDPerfScripts.StartScreen import *
from ROOT import *
from Utils import *
@KonstantinSchubert
KonstantinSchubert / getAnyTree
Created December 5, 2014 15:08
CERN ROOT: A function that gets the first tree out of a .root -file.
TTree* getAnyTree(TDirectory* dirHandle){
// Returns a pointer to a TTree from within the file. Useful if you know there is only one tree in the file, but don't knowe which and where exactly.
// within ROOT, a TTree is a TObject and a TDirectory is a TObject. But a Tree is not a TDirectory and vice versa.
TObject* objectHandle = NULL;
do{
const char* key = dirHandle->GetListOfKeys()->At(0)->GetName(); // Get the first key in the directory
objectHandle = dirHandle->Get(key); // Get the first object.
dirHandle = dynamic_cast<TDirectory*> (objectHandle); // try to cast object into directory