Skip to content

Instantly share code, notes, and snippets.

@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 / md-cal.sh
Last active December 31, 2022 17:14
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 / 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 / marp-example.md
Created July 13, 2020 20:48
Marp style block for custom css in preview AND export
theme _class backgroundColor marp footer tags
gaia
lead
true
Daniel Brandenburg | 07142020
<style> /* this works for export */
@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" />
@jdbrice
jdbrice / starlight_reader_example.C
Created July 28, 2021 18:06
Example reader code for STARLight text format
ifstream infile( starlight.c_str() );
int iEvent =0;
while (infile) {
string sEvent, sVertex, sTrack1, sTrack2;
if (!getline( infile, sEvent )) break;
if (!getline( infile, sVertex )) break;
if (!getline( infile, sTrack1 )) break;
if (!getline( infile, sTrack2 )) break;