Skip to content

Instantly share code, notes, and snippets.

StMemStat stm;
void printMEM(){
stm.PrintMem();
}
#include <fstream>
#include "StMemStat.h" // Ensure this is available and correctly included
#include <TMinuit.h>
#include <TVirtualFitter.h>
#include <TGraph.h>
#include <TCanvas.h>
#include <TFile.h>
#include <TStyle.h>
#include <TF1.h>
#include <TF1Convolution.h>
#include <TLegend.h>
#include <iostream>
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 / 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 / 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");