Skip to content

Instantly share code, notes, and snippets.

View RFQED's full-sized avatar
💭
🪨

Will Turner RFQED

💭
🪨
View GitHub Profile
@RFQED
RFQED / Root Commands
Created November 9, 2017 21:03
Useful root commands for restlying a plot
[wturner@gm2ucl MCTrackMatchedEvents]$ root -l TracksVsCaloPlots_truth.root
root [0]
Attaching file TracksVsCaloPlots_truth.root as _file0...
(TFile *) 0x4025140
root [1] TBrowser UYTRE
(TBrowser &) Name: Browser Title: ROOT Object Browser
root [2] Warning in <TH1F::Rebin>: ngroup=6 is not an exact divider of nbins=1000.
root [13] _file0->ls()
TFile** TracksVsCaloPlots_truth.root
// Include needed ART headers
#include "art/Framework/Core/EDProducer.h"
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Services/Optional/TFileService.h"
#include "art/Framework/Services/Registry/ServiceHandle.h"
//Geant4
#include "Geant4/G4SystemOfUnits.hh"
@RFQED
RFQED / joinRootFiles.fcl
Created November 7, 2017 19:48
fcl file for loading in a number of root files and outputting just one
process_name : JoinRootFiles
source :
{
module_type : RootInput
maxEvents : -1
}
physics :
{
@RFQED
RFQED / joinRootOutput.sh
Last active November 7, 2017 21:32
join output from a large sim job into fewer, more manageable files
#!/bin/bash
# make a text file of all the grid job output locations
# split this large text file into many smaller ones (using `split`)
# use this script to loop over the files and submit a gm2 job for each split of the text file
checkProc() {
if [ $(ps -ef | grep -v grep | grep 'gm2 -c ../srcs/gm2tracker/fcl/JoinRootFiles.fcl' | wc -l) -lt 10 ]; then
check=1
else
#include "messageParams.fcl"
#include "fillBuilderParams.fcl"
#include "digitalizerParams.fcl"
#include "recoIslandParams.fcl"
#include "recoClusterParams.fcl"
#include "recoSeedParams.fcl"
#include "recoFindingParams.fcl"
#include "recoT0FinderParams.fcl"
#include "calDigitalizerParams.fcl"
# unpacks tracker and calos 17, 18, 19, 20 data
#include "messageParams.fcl"
#include "trackerLoggerParams.fcl"
#include "strawUnpackerParams.fcl"
#include "strawCleaningParams.fcl"
#include "strawRawDigitParams.fcl"
#include "strawDAQDigitParams.fcl"
@RFQED
RFQED / readVacGauge.py
Last active October 21, 2017 22:19
readVacGauge.py
############################################################################
#
# Python Script which takes the vacuum pressure and saves it to a text file
# and is able to plot it to a live updating interative graph.
#
# useage python VacTank.py --Module_Number #
# --Module_Number is the module number under test and is saved in the output filename
#
# to get the page to refresh automatically can edit the html code which gets saved
# /home/g2uol/Desktop/Will/Python/Python-3.3.5-install/lib/python3.3/site-packages/plotly-1.9.10-py3.3.egg/plotly/offline
$(function() {
'use strict';
var socket = io('/', {path: '/trackerSocket'});
registerCommonCallbacks(socket);
// UView Straw X / Y positions this is the base graph that the hits are plotted ontop of.
var UView = {
x: [-12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, \
-12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -12.696, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, -7.5, \
@RFQED
RFQED / Unpacker.fcl
Last active August 7, 2017 20:40
fcl file used to unpack data from the two voltages to look at straw tracker drift times
# Quickly unpacks tracker and calos 17, 18, 19, 20 data, retains only hit info
#include "messageParams.fcl"
#include "trackerLoggerParams.fcl"
#include "strawUnpackerParams.fcl"
#include "strawCleaningParams.fcl"
#include "strawRawDigitParams.fcl"
#include "strawDAQDigitParams.fcl"
@RFQED
RFQED / Tension.c
Last active November 8, 2016 10:41
/* PINGER PROGRAM
This sketch is for the determination of the tension of a wire in
a magnetic field by outputting a pulse train on pin 11 which switches a
current into the wire which displaces the wire in the magnetic field.
The frequency is swept up and down and the signal amplitude is monitored to find
a maximum and hence determine the resonant frequency.
Thanks to Martin Nawrath - Kunsthochschule fuer Medien Koeln - Academy of Media Arts Cologne
for DDS Sine Generator code. It saved a lot of time reading the CPU manual.
Timer2 generates the 31250 KHz Clock Interrupt
*/