Skip to content

Instantly share code, notes, and snippets.

Andy Mastbaum mastbaum

Block or report user

Report or block mastbaum

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mastbaum /
Created Apr 11, 2017
RAT-PAC setup to look at antiprotons
// This lives in user/
/// \file
/// \brief An example User Processor
/// This example demonstrates how to write a User Processor. MyUserProc
/// (declared and defined below) just creates a 1-D histogram of the number of
/// photoelectrons in each event, filled it as events are generated and writes
/// it to a file called "numpe.root".
mastbaum / hough.cpp
Created Dec 4, 2015
Hough transform for QEvents
View hough.cpp
#include <cmath>
#include <TH2F.h>
#include <TVector3.h>
#include <QEvent.h>
#include <QGlobals.h>
#include <QPMTxyz.h>
TH2F* hough(const QEvent* event, TVector3& vfit, float tres_cut, bool qweight) {
// Calculate Cherenkov angle using FTK energy
float beta = sqrt(1.0 - (0.511 / (0.511 + e)) * (0.511 / (0.511 + e)));
mastbaum / startnode
Created Nov 1, 2015
Docker SLURM node Resume and Suspend scripts
View startnode
echo "`date` Resume invoked $0 $*" >> /var/log/slurm-llnl/power_save.log
hosts=`scontrol show hostnames $1`
for host in $hosts
docker run --rm \
--name $host \
-h $host \
-v /home:/home \
mastbaum / Dockerfile
Last active Nov 1, 2015
Dockerfile for Ubuntu 14.04 SLURM
View Dockerfile
FROM ubuntu:14.04
RUN apt-get update && apt-get -y install munge slurm-llnl
RUN mkdir -p /var/run/munge && \
chown munge:munge /var/run/munge && \
chmod 0700 /etc/munge && \
chmod 0711 /var/lib/munge && \
chmod 0700 /var/log/munge && \
chmod 0755 /var/run/munge && \
mastbaum / slurm.conf
Last active May 17, 2017
Example slurm.conf for elastic cluster
View slurm.conf
# Example /etc/slurm-llnl/slurm.conf
mastbaum /
Created Oct 15, 2015
Markdown lab notebook generator
# Collect the Markdown. Webpage it.
# Searches subdirectories for Markdown files and creates a static webpage
# with frames for navigation in a new directory _notebook/. Also copies
# over any images referenced in the md source.
# A. Mastbaum <>, 10/2015
mastbaum /
Created Jul 22, 2015
Python dates & times example
from datetime import datetime
import pytz # Probably need to install this one on your system
import dateutil.parser
# An example timestamp string
timestamp = "2014-12-12T08:51:06.082327-05:00"
# Convert the string to a datetime object
timestamp_obj = dateutil.parser.parse(timestamp)
mastbaum / mcphoton.cpp
Created Jun 10, 2015
Plot RAT-PAC MC photon data
View mcphoton.cpp
* Example script for drawing MCPhoton information from RAT-PAC ROOT files.
* Usage:
* root[0] .L mcphoton.cpp+
* root[1] plotMCData("myfile.root");
* A. Mastbaum <>, June 2015
mastbaum /
Created May 8, 2015
Neutrinoless double-beta decay "lobster" plot
'''Make the "lobster plot."
That is, the possible values of the Majorana mass given the mixing parameters
and assuming standard three-neutrino mixing, for the normal and inverted
mass hierarchy.
By the way, the current global best fit parameters from NuFit are:
sin(t12)^2 = 0.304 +/- 0.012
sin(t23)^2 = 0.451 +/- 0.002 (first quadrant)
mastbaum /
Last active Dec 8, 2016
Nagios plugin to check that CouchDB replications are working
#!/usr/bin/env python
'''Check to make sure that all the replications on the local CouchDB server
are actually running.'''
import argparse
from datetime import datetime, timedelta
from operator import itemgetter
import requests
import sys
import tempfile
You can’t perform that action at this time.