Skip to content

Instantly share code, notes, and snippets.

View riga's full-sized avatar

Marcel Rieger riga

View GitHub Profile
@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
@riga
riga / custom_rise.css
Last active July 10, 2020 17:57
Custom CSS for RISE presentations
body.rise-enabled div.prompt_container {
background-color: red !important;
}
div#notebook {
background-color: green !important;
}
# coding: utf-8
"""
Command to run the tasks:
luigi --module progress_tasks TaskB --workers 2
"""
import time
import luigi
@riga
riga / slurm_test.py
Last active March 4, 2020 18:07
Law slurm submission test
# coding: utf-8
import time
import law
def test_htcondor():
# load the htcondor contrib package, making all exported objects available under law.htcondor
@riga
riga / testDeepJetPerformance.cc
Last active February 4, 2020 16:45
CMS DeepJet performance test between TF and ONNX
/*
* Performance test of the DeepJet model with both TensorFlow and ONNXRuntime.
* Place this file into a cmssw test directory and add the following to the BuildFile.xml:
*
* <bin name="testTFDeepJetPerformance" file="testRunner.cpp,testDeepJetPerformance.cc">
* <use name="cppunit" />
* <use name="FWCore/Utilities" />
* <use name="PhysicsTools/TensorFlow" />
* <use name="PhysicsTools/ONNXRuntime" />
* </bin>