Skip to content

Instantly share code, notes, and snippets.

@jdbrice
jdbrice / battery.applescript
Created September 5, 2018 02:16
battery widget applescript for better touch tools
set theList to paragraphs of text of (do shell script "pmset -g batt")
set percent to word 6 of theList's item 2
set charge to word 7 of theList's item 2
if (charge = "charging") then
set iconC to "⚡️"
else
set iconC to ""
end if
@jdbrice
jdbrice / spotify_now_playing.applescript
Created September 5, 2018 01:59
apple script for spotify now playing in better touch tools
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then
return (get artist of current track) & " – " & (get name of current track)
else
return ""
end if
end tell
end if
@jdbrice
jdbrice / play_pause.applescript
Created September 5, 2018 01:58
play pause apple script for Better TouchTools
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then return "pause"
end tell
end if
if application "iTunes" is running then
tell application "iTunes"
if player state is playing then return "pause"
end tell
@jdbrice
jdbrice / sample_submit.xml
Created August 28, 2018 14:18
Sample RCF condor submit XML file
<job name="MuDst2FemtoDst_Run15_pp200" simulateSubmission ="false" maxFilesPerProcess="10" filesPerHour="50" >
<stdout URL="file:/star/data03/pwg/jdb/scratch/log/log_$JOBID.log" />
<stderr URL="file:/star/data03/pwg/jdb/scratch/log/err_$JOBID.err" />
<output fromScratch="*FemtoDst.root" toURL="file:/star/data03/pwg/jdb/scratch/" />
<input URL="catalog:star.bnl.gov?trgsetupname=AuAu200_production_2011,filetype=daq_reco_MuDst,filename~st_upc,storage=local" nFiles="50000" />
<command>
@jdbrice
jdbrice / blank.condor.config.sh
Created June 13, 2018 17:02
Submit jobs to condor easily
GetEnv = True
@jdbrice
jdbrice / scale.C
Created May 29, 2018 04:33
Shuai's ccbar scaling code
void scale(){
TFile *f = new TFile( "cc2ee_dimuonAcc_2014BR.root" );
TH1 * hnParent = (TH1*)f->Get( "nParent" );
TH2 * hMcAcc = (TH2*)f->Get( "hMCAcc1MvsPtcc2ee" );
double Ncc = hnParent->GetBinContent(1);
@jdbrice
jdbrice / bias.C
Created May 29, 2018 04:30
NColl Bias
TChain *c = NULL;
double meanNcollAt( float mlow, float mhigh ){
TH1D * hncoll = new TH1D( "hncoll", "", 1000, 0, 1000 );
TString cut = TString::Format("mult > %f && mult <= %f", mlow, mhigh );
c->Draw( "ncoll>>hncoll", cut );
@jdbrice
jdbrice / export_params.C
Created May 29, 2018 04:23
Run13 TOF reso export
void print_tray( int tray ){
cout << endl << tray << " 0" << endl;
}
void export_params(){
@jdbrice
jdbrice / SubHistoMaker.h
Created April 25, 2018 03:10
A sub class of HistoMaker
#ifndef SIGNAL_MAKER_H
#define SIGNAL_MAKER_H
#include "HistoAnalyzer.h"
#include "vendor/loguru.h"
class SignalMaker : public HistoAnalyzer {
protected:
@jdbrice
jdbrice / VpdTriggerBank.C
Last active March 6, 2017 20:27
Accessing VPD Trigger Data from MuDst
#include "StEvent/StTriggerData2016.h"
// "event" is a class object storing the data into an nTuple
void StVpdPicoDstMaker::analyzeEvent(){
StMuEvent *muEvent = muDst->event();
const StTriggerData2016 *td = (StTriggerData2016*)muEvent->triggerData();