Skip to content

Instantly share code, notes, and snippets.

View jpata's full-sized avatar

Joosep Pata jpata

View GitHub Profile
using Cxx
const ROOT_PATH = "/Users/joosep/Documents/root-build/"
addHeaderDir(joinpath(ROOT_PATH, "include"), kind=C_System)
for lib in ["Core", "RIO", "Hist"]
Libdl.dlopen("$ROOT_PATH/lib$lib.so", Libdl.RTLD_GLOBAL)
end
cxx"""#include <TFile.h> """
cxx"""#include <TH1D.h> """
import cProfile, time
def func():
s = 0
for i in range(100000):
s += i
p = cProfile.Profile(time.clock)
p.runcall(func)
p.print_stats()
import dask
import sys, glob
import numpy as np
def fixPath():
newpath = []
for v in sys.path:
if "cvmfs" in v and "pandas" in v:
continue
newpath += [v]
//compile as c++ -g `root-config --cflags --libs` CloneTreeCorruption.cc -o CloneTreeCorruption
#include "TFile.h"
#include "TTree.h"
int main(int argc, const char** argv) {
TFile* inf = new TFile("DoubleEG_Run2015D_v4_7_post.root");
TTree* intree = (TTree*)(inf->Get("mt2"));
ULong64_t evt;
intree->SetBranchAddress("evt", &evt);
TFile* outf = new TFile("out.root", "RECREATE");
MEM::get_support: E(reco) = 148.35699 ==> range at 0.98 CL is [68.356995, 430.85699] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 148.35699 ==> range at 0.98 CL is [70.856995, 650.85699] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 138.43381 ==> range at 0.98 CL is [63.433807, 403.43381] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 138.43381 ==> range at 0.98 CL is [65.933807, 610.93381] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 75.970924 ==> range at 0.98 CL is [23.470924, 243.47092] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 75.970924 ==> range at 0.98 CL is [30.970924, 365.97092] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 43.183689 ==> range at 0.98 CL is [0, 155.68369] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 43.183689 ==> range at 0.98 CL is [0, 183.18369] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 176.26241 ==> range at 0.98 CL is [98.762405, 498.76241] (stepping every 2.5 GeV)
MEM::get_support: E(reco) = 176.26241 ==> range at
import ROOT
f = ROOT.TFile("/Users/joosep/Documents/tth/data/ntp/v16/Jan18_fixbdt/TT_TuneCUETP8M1_13TeV-powheg-pythia8.root")
t = f.Get("tree")
of = ROOT.TFile("x.root", "RECREATE")
of.cd()
t.CopyTree("is_sl==1")
of.Add(t)
@jpata
jpata / dumpjets.py
Created January 20, 2016 10:31
cMVAv2 CMSSW 763 validation
import ROOT
from DataFormats.FWLite import Events, Handle
events = Events ('exerciseIPartII_histos.root')
handle = Handle ('std::vector<pat::Jet>')
label = ("selectedPatJets")
for event in events:
event.getByLabel(label, handle)
using namespace reco;
using namespace PhysicsTools;
CombinedMVAJetTagComputerETH::CombinedMVAJetTagComputerETH(
const edm::ParameterSet &params) :
GenericMVAJetTagComputer(params)
{
std::cout << "CombinedMVAJetTagComputerETH::constructor" << std::endl;
inputComputerNames = params.getParameter< std::vector<std::string>>(
using namespace reco;
using namespace PhysicsTools;
CombinedMVAJetTagComputerETH::CombinedMVAJetTagComputerETH(
const edm::ParameterSet &params) :
GenericMVAJetTagComputer(params)
{
std::cout << "CombinedMVAJetTagComputerETH::constructor" << std::endl;
inputComputerNames = params.getParameter< std::vector<std::string>>(
@jpata
jpata / gist:5495494
Last active December 16, 2015 20:49
int addr = 0
void loop()
{
if (digitalRead(D1) == 1) {
// need to divide by 4 because analog inputs range from
// 0 to 1023 and each byte of the EEPROM can only hold a
// value from 0 to 255.
int val = analogRead(0) / 4;