Skip to content

Instantly share code, notes, and snippets.

View alexpearce's full-sized avatar

Alex Pearwin alexpearce

View GitHub Profile
_____ _____ _____ _____
/\ \ /\ \ /\ \ /\ \
/::\ \ /::\____\ /::\ \ /::\ \
/::::\ \ /::::| | \:::\ \ /::::\ \
/::::::\ \ /:::::| | \:::\ \ /::::::\ \
/:::/\:::\ \ /::::::| | \:::\ \ /:::/\:::\ \
/:::/__\:::\ \ /:::/|::| | \:::\ \ /:::/__\:::\ \
/::::\ \:::\ \ /:::/ |::| | /::::\ \ /::::\ \:::\ \
/:::::
@alexpearce
alexpearce / test_simultaneous_fit.py
Created January 6, 2015 14:25
Test simultaneous fitting in kinematic bins.
import ROOT as R
from ROOT import RooFit as RF
from charmproduction import config, utilities
def create_binning(var, edges):
"""Return RooBinning for var with bin edges.
Lowest and highest bin edge are automatically added from
@alexpearce
alexpearce / monitor_requirements.txt
Created January 7, 2015 12:00
Python requirements files
Flask==0.10.1
Jinja2==2.7.3
MarkupSafe==0.23
Werkzeug==0.9.6
uWSGI==2.0.7
honcho==0.5.0
itsdangerous==0.24
redis==2.10.1
# Use a patched rq v0.4.6
# Fixes a problem where workers would have completed status before saving the payload
@alexpearce
alexpearce / fake_phi.py
Created January 12, 2015 16:06
Fake phi combination
phi_combination = CombineParticles(
'CombineCheatedphiToKK',
Preambulo=truth_matching_preambulo,
# There's no "anti-phi", so no [...]cc
DecayDescriptors=['phi(1020) -> K- K+'],
Inputs=[
kaons
],
# The D_s+ MC sample models the resonant phase space but doesn't insert
# actual resonant particles, so there isn't a real phi
@alexpearce
alexpearce / stdout_with_phi
Last active August 29, 2015 14:13
DaVinci log running over 23263020 MC with fake_phi options.
Using the master optionsfile: options.pkl
********************************************************************************
* ---- LHCb Login v8r3 ---- *
* Building with gcc48 on slc6 x86_64 system (x86_64-slc6-gcc48-opt) *
********************************************************************************
--- User_release_area is set to /afs/cern.ch/user/a/apearce/cmtuser
--- LHCBPROJECTPATH is set to:
/afs/cern.ch/lhcb/software/releases
/afs/cern.ch/sw/Gaudi/releases
/afs/cern.ch/sw/lcg/releases
@alexpearce
alexpearce / test_ttreeformula.py
Created January 19, 2015 08:48
TTreeFormula example
import ROOT
# Replace with location to your favourite ntuple
f = ROOT.TFile((
'/Users/apearce/Physics/Data/CharmProduction2010/Reprocessed'
'/DVntuple.2010.12.MagUp.root'
), 'read')
t = f.Get('TupleD0Tohh/DecayTree')
h1 = ROOT.TH1F('h1', 'h1', 170, 1780, 1950)
h2 = ROOT.TH1F('h2', 'h2', 170, 1780, 1950)
@alexpearce
alexpearce / alias.py
Created January 30, 2015 10:57
TTree::SetAlias example
import ROOT
import numpy
f = ROOT.TFile('alias.root', 'recreate')
t = ROOT.TTree('t', 't')
a = numpy.zeros(1, dtype=float)
t.Branch('a', a, 'a/D')
for i in range(10):
@alexpearce
alexpearce / make_error.log
Created February 4, 2015 16:29
make error
g++ -c -o obj/TMVAClassification.o src/TMVAClassification.cxx -g -O0 -I./include/ -Wall -std=c++11 -fPIC -pthread -stdlib=libc++ -std=c++11 -m64 -I/usr/local/Cellar/root6/6.02.04/include/root
g++ -c -o obj/AnyWriter.o src/AnyWriter.cxx -g -O0 -I./include/ -Wall -std=c++11 -fPIC -pthread -stdlib=libc++ -std=c++11 -m64 -I/usr/local/Cellar/root6/6.02.04/include/root
g++ -c -o obj/DConfig.o src/DConfig.cxx -g -O0 -I./include/ -Wall -std=c++11 -fPIC -pthread -stdlib=libc++ -std=c++11 -m64 -I/usr/local/Cellar/root6/6.02.04/include/root
g++ -c -o obj/MyUtils.o src/MyUtils.cxx -g -O0 -I./include/ -Wall -std=c++11 -fPIC -pthread -stdlib=libc++ -std=c++11 -m64 -I/usr/local/Cellar/root6/6.02.04/include/root
g++ -c -o obj/BDTTools.o src/BDTTools.cxx -g -O0 -I./include/ -Wall -std=c++11 -fPIC -pthread -stdlib=libc++ -std=c++11 -m64 -I/usr/local/Cellar/root6/6.02.04/include/root
rootcint -f dict/MyDict.cxx -c -p include/ROOTex.h include/LinkDef.h
g++ -c -o obj/ROOTex.o dict/MyDict.cxx -I./ -g -O0 -I./include/ -Wall -std=c+
@alexpearce
alexpearce / shutup.patch
Created February 5, 2015 10:07
Shut up, RooFit
diff --git a/roofit/roofitcore/src/RooBanner.cxx b/roofit/roofitcore/src/RooBanner.cxx
index 89c0338..8cc41b9 100644
--- a/roofit/roofitcore/src/RooBanner.cxx
+++ b/roofit/roofitcore/src/RooBanner.cxx
@@ -10,6 +10,7 @@
// END_HTML
//
+#define __ROOFIT_NOBANNER
using namespace std;
@alexpearce
alexpearce / simul.py
Created February 6, 2015 16:20
Simultaneous fit
import ROOT as R
from ROOT import RooFit as RF
# 'Unblind' or 'Blind'
# BLINDING = 'Blind'
BLINDING = 'Unblind'
BLIND_STR = '6LJgnoyA4Zr95gec'
def roovar_value(rv):
'''Return a pretty-printed central value and uncertainty of rv.