Skip to content

Instantly share code, notes, and snippets.

@jdbrice
jdbrice / qed_cal_ptw.C
Created July 18, 2025 16:35
pair pt constrained QED matrix integrator
double cal_ptw(const double *x){
TLorentzVector p1(0,0,0,0); // electron daughter
p1.SetPtEtaPhiM(x[0],x[1],x[2],mlepton);
TLorentzVector p2(0,0,0,0); // positron daughter
double pt = sqrt((par[1]*TMath::Cos(x[3])-p1.X())*(par[1]*TMath::Cos(x[3])-p1.X())+(par[1]*TMath::Sin(x[3])-p1.Y())*(par[1]*TMath::Sin(x[3])-p1.Y()));
// express the positron in terms of the pair and electron.
p2.SetXYZM(par[1]*TMath::Cos(x[3])-p1.X(),par[1]*TMath::Sin(x[3])-p1.Y(),pt*TMath::SinH(x[4]),mlepton);
@jdbrice
jdbrice / cnc_mover.py
Created May 30, 2025 00:49
Serial connection and g-code sending to CNC
import time
from serial import Serial
from serial.tools import list_ports
from tqdm import tqdm
from contextlib import closing
# TODO: arg parse for port and baudrate
# TODO: arg parse for X/Y coordinates and to select initial home machine, just unlock, or none (if machine is already unlocked)
x = 20
@jdbrice
jdbrice / Dockerfile
Created April 22, 2025 18:12
SuperChic 5.4.1 Dockerfile Fedora:40
FROM fedora:40
RUN yum -y install gcc gcc-c++ gcc-gfortran make cmake cmake-data git
RUN yum -y install HepMC3 HepMC3-devel HepMC3-search lhapdf lhapdf-devel python-lhapdf pythia8 pythia8-devel
ADD SuperChic /SuperChic
RUN cd /SuperChic && cmake -S . -B BUILD && cmake --build BUILD && cmake --install BUILD
RUN yum -y install vim
RUN lhapdf install MSHT20qed_nnlo
@jdbrice
jdbrice / PicoSizes.C
Last active April 1, 2025 19:56
Size of PicoDst structures
#include <iostream>
#include "StPicoEvent/StPicoEvent.h"
#include "StPicoEvent/StPicoTrack.h"
#include "StPicoEvent/StPicoBTowHit.h"
#include "StPicoEvent/StPicoBTofHit.h"
#include "StPicoEvent/StPicoMtdHit.h"
#include "StPicoEvent/StPicoEmcTrigger.h"
#include "StPicoEvent/StPicoBTofPidTraits.h"
#include "StPicoEvent/StPicoMtdPidTraits.h"
#include "StPicoEvent/StPicoEmcPidTraits.h"
@jdbrice
jdbrice / md-cal.sh
Last active October 8, 2024 11:49
Generate markdown table calendar. Use wiki links to individual days
# Author: Daniel Brandenburg
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@jdbrice
jdbrice / Makefile
Created September 30, 2024 14:26
t-distribution fit, simple WS
CXX=g++
RM=rm -f
CPPFLAGS=-g $(shell root-config --cflags)
LDFLAGS=-g $(shell root-config --ldflags)
LDLIBS=$(shell root-config --libs --glibs)
SRCS=wsfit.cxx
OBJS=$(subst .cxx,.o,$(SRCS))
all: wsfit
@jdbrice
jdbrice / dbash.sh
Created September 10, 2016 18:16
Jump into a docker exec bash shell
#!/bin/bash
docker exec -ti $1 /bin/bash
@jdbrice
jdbrice / bookmarklet.js
Created February 13, 2022 17:31 — forked from tomcritchlow/bookmarklet.js
Gist code for Electric Tables V0.2.
// Convert this JS code into a bookmarklet using a tool like: http://js.do/blog/bookmarklets/
// Be sure to add your own macro_url and spreadsheet_url
var macro_url = "THIS IS YOUR MACRO URL";
var spreadsheet_id = "THIS IS YOUR SPREADSHEET URL";
var iframe = document.createElement("iframe");
iframe.setAttribute("name","dummyframe");
iframe.setAttribute("id","dummyframe");
iframe.setAttribute("style","display:none;");
@jdbrice
jdbrice / read_mudst.C
Created December 6, 2021 22:27
Read MuDST for testing FTT structures
void read_mudst(char* file="input.MuDst.root",
int ifile=-1, Int_t nevt=-1, char* outdir=".", int readMuDst=1){
gROOT->Macro("Load.C");
gROOT->Macro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
gSystem->Load("StEventMaker");
gSystem->Load("StFcsDbMaker");
gSystem->Load("StFttRawHitMaker");
@jdbrice
jdbrice / VMMHardwareMap.h
Created November 17, 2021 14:21
Hardware mapping class for VMM
#include <assert.h>
#include <fstream>
/*********************************************************/
// class for mapping the VMM electronics
//
// Some terminology
// in the raw data from Tonko we have (SEC, RDO, FEB ...)
// these correspond to our sTGC naming as:
//
// SEC = Plane (1, 2, 3, 4)