Skip to content

Instantly share code, notes, and snippets.

View riga's full-sized avatar

Marcel Rieger riga

View GitHub Profile
@riga
riga / met_phi_correction.py
Last active October 11, 2022 16:29
CMS MET Phi (Type II) correction
# coding: utf-8
"""
Lightweight Python implementation of the Run 2 MET phi (type II) correction, following
https://lathomas.web.cern.ch/lathomas/METStuff/XYCorrections/XYMETCorrection_withUL17andUL18andUL16.h,
taken from https://twiki.cern.ch/twiki/bin/view/CMS/MissingETRun2Corrections?rev=72.
Downloadable source at https://mrieger.web.cern.ch/snippets/met_phi_correction.py,
gist at https://gist.github.com/riga/951076bcde6ea7cb4da2bf7c7417379a.
@riga
riga / Makefile
Last active May 26, 2024 19:44
Accelerated Graph Evaluation with TensorFlow XLA AOT
INC = -I${TF_INSTALL_PATH}/include
LIB = -L${TF_INSTALL_PATH}/xla_aot_runtime_src
LIBS = -lpthread -ltf_xla_runtime
CXXFLAGS = -D_GLIBCXX_USE_CXX11_ABI=0
.phony: all clean
all: test_model
test_model: test_model.cc my_model.o
@riga
riga / cmsdist.md
Last active September 1, 2023 09:21
First steps with cmsdist

First steps with cmsdist

1. Create fork of cmsdist

  • Go to https://github.com/cms-sw/cmsdist
  • Fork the repository into your user space by clicking on the "Fork" bottom at the top right. If you don't have a personal GitHub account yet, please create one and create the fork.

2. Setup cmsdist and pkgtools

@riga
riga / calib.py
Created October 21, 2021 17:01
Calibration curves with ROOT
# coding: utf-8
from array import array
from scinum import Number
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
ROOT.gROOT.SetBatch()
@riga
riga / index.php
Created August 16, 2021 14:56
Index page for viewing plots in web browsers (copy recursively to subdirectories)
<?
// CHANGE ME: add your local www root here
$local_root = "/eos/home-i03/m/mrieger/www";
// extensions to scan
$additional_extensions = array("pdf", "cxx", "eps", "root", "txt");
// mode for showing hits when searching
// "all", "any" or empty
$search_pattern_mode = "any";
@riga
riga / eos_download.py
Created July 19, 2021 10:45
Helpers for loading remote files from CERN EOS.
# coding: utf-8
"""
Helpers for loading remote files from CERN EOS.
"""
import os
import subprocess
import six
@riga
riga / bin_labels.py
Last active May 20, 2021 10:30
Edge aligned bin labels in ROOT
# coding: utf-8
# import root into a cage
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
ROOT.gROOT.SetBatch()
# preps
canvas = ROOT.TCanvas()
@riga
riga / README.md
Last active March 29, 2021 10:50
Files and scripts required for CMS TDR documents on Overleaf

CMS TDR documents on Overleaf

This gist demonstrates how to prepare CMS TDR documents to work on Overleaf.

All of the following files should be copied to the root directory of your project:

  • build.sh: Compiles the document once and saves a tex document (and the current pdf) to a new directory, named "overleaf" by default, which can be used as a root document on Overleaf. Please note that changes to this document get lost once this build script is executed again.
  • build_docker.sh: Executes the build script in a docker container using the official tdr build image.
  • latexmkrc: Tells the LaTeX compiler on Overleaf where to find the tdr tool.
@riga
riga / law_root_examples.py
Last active September 29, 2021 12:15
Working with ROOT files in law.
# coding: utf-8
# This script showcases a few examples on how to simplify working with ROOT objects within law.
#
# Scope:
# 1. Usage of the low-level GuardedTFile
# 2. Reading and writing ROOT files via target formatters
# 3. Merging ROOT files with hadd_task
import law
@riga
riga / tf_times_two.py
Last active August 6, 2020 13:49
Example gist to showcase the cms_gist_runner.
# coding: utf-8
"""
Example gist to be used with the cms_gist_runner. Execute via
> ~mrieger/public/bin/cms_gist_runner 522d2d08dab617a46444213fe202d919 -v CMSSW_11_1_2 -t
"""
import tensorflow as tf