Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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)
@jdbrice
jdbrice / Example_output_runNumber_22316001
Created November 12, 2021 17:12
sTGC pulser hash generator, runNumber provids a "random" seed
FEE[0] : 0000101110011101001001000011100100010110111010111011111011110111000010111001110100100100001110010001011011000101001100011000000000001011100111010010010000111001000101110011100011011001111001010000101110011101001001000011100100010111000100100100110001101110
FEE[1] : 0010101111000111100101011100111001001010000101111001001111010000001010111100011110010101110011100100101000111110001000010100011100101011110001111001010111001110010010100110010010101110101111100010101111000111100101011100111001001010100010110011110000110101
FEE[2] : 1100101101000111100000010111011011001111111101000011011100010100110010110100011110000001011101101101000000011010110001001000101111001011010001111000011101000101000111010010011101101001011101111100101101000111100001110100010100011101000000001101110000000000
FEE[3] : 1110101101110010101110000111001001001001010110001010000111001111111010110111001010111000011100100100100100110010000101000101100011101011011100101011100001110010010010011010010110111100101111011110101101110010101100101
@jdbrice
jdbrice / README.md
Created November 11, 2021 03:14
Read sTGC data from RTS_Example and wwrtie to ROOT TTree

Example:

cd /star/u/jdb/work/ssw/stgc-raw-hit-reader/StRoot/RTS/src/RTS_EXAMPLE starver dev make make ./rts_example /star/data03/pwg/jdb/FWD/daq/stgc-cosmic/st_hltcosmic_22314049_raw_0000002.daq -D stgcsctrg > /star/data03/pwg/jdb/FWD/daq/stgc-cosmic/st_hltcosmic_22314049_raw_0000002.daq.dat

If needed, copy output to wherever the above two scripts are root -b -q -l 'read_RTS.C( "/star/data03/pwg/jdb/FWD/daq/stgc-cosmic/st_hltcosmic_22314049_raw_0000002.daq.dat" )'

@jdbrice
jdbrice / WIPStgmGeo.xml
Last active September 28, 2021 20:18
Work in progress sTGC geometry with pentagonal design
<Document file="StarVMC/Geometry/StgmGeo/StgmGeo1.xml">
<Replace match="GeV">*1.0E+0;</Replace>
<Replace match="MeV">*1.0E-3;</Replace>
<Replace match="keV">*1.0E-6;</Replace>
<Module name="StgmGeo1" comment="Forward Tracking System Geometry / developed for the sTGC tracker">
<Created date="08/19/2021" />
<Author name="Daniel Brandenburg" />