Skip to content

Instantly share code, notes, and snippets.

@pgjones
pgjones / DSReader.cc
Last active August 29, 2015 13:56
Load a root file using the DSReader
//open the root file with the DSReader
RAT::DSReader reader("nhits.root");
RAT::DS::Root* rds = reader.NextEvent();
while(rds != NULL)
{
rds = reader.NextEvent();
}
////////////////////////////////////////////////////////////////////////
/// \class RAT::DS::DataCleaningFlags
///
/// \brief This class contains the data cleaning flags for an event
///
/// \author R Bonventre <rbonv@hep.upenn.edu>\n
/// Phil G Jones <p.g.jones@qmul.ac.uk>
///
/// REVISION HISTORY:\n
/// 2013-10-16: P G Jones - New ds refactor. \n
@pgjones
pgjones / EV.hh
Last active August 29, 2015 13:57
/// Get the uncalibrated PMTs
///
/// @return the set of uncalibrated pmts
PMTSet<PMTUnCal>& GetUncalibratedPMTs() { return uncalibratedPMTs;}
const PMTSet<PMTUnCal>& GetUncalibratedPMTs() const { return uncalibratedPMTs;}
/// Get the calibrated PMTs
///
/// @return the set of calibrated pmts
PMTSet<PMTCal>& GetCalibratedPMTs() { return calibratedPMTs;}
@pgjones
pgjones / Convert.cc
Created March 23, 2014 12:08
Converts a space delimited file with `particle_type kinetic_energy time x_position y_position z_position` in to a RAT::DS root file.
#include <RAT/DS/Root.hh>
#include <RAT/DS/MC.hh>
#include <RAT/DS/MCParticle.hh>
#include <TFile.h>
#include <TTree.h>
#include <fstream>
using namespace std;
/rat/db/set GEO[scint] material "what scintillator did you use?"
/run/initialize
# BEGIN EVENT LOOP
/rat/proc classifier
/rat/procset classifier "nearAVAngular"
/rat/proc fitter
/rat/procset method "nearAVAngular"
@pgjones
pgjones / Load.cc
Last active August 29, 2015 14:03
Example TChain root file loading for rat-4.5.0
////////////////////////////////////////////////////////
/// My preferred method to load a root file in root.
/// Must load in root as .L Load.cc+
///
/// 11/10/2012 : New File
////////////////////////////////////////////////////////
#include <RAT/DS/Root.hh>
#include <RAT/DS/EV.hh>
#include <RAT/DS/Run.hh>
@pgjones
pgjones / PlotCAEN.cc
Last active August 29, 2015 14:04
This is a workflow to load zdab, convert to RAT::DS (root) and then in a separate script plot the results.
// To run this open ROOT and do
// .L PlotCAEN.cc+
// PlotCAEN( "output_filename.root", 10 );
// where the number is the event id you'd like to view the waveforms of
#include <RAT/DU/DSReader.hh>
#include <RAT/DS/Entry.hh>
#include <RAT/DS/Digitiser.hh>
#include <TCanvas.h>
#include <TGraph.h>
@pgjones
pgjones / G4OpRayleigh.cc
Last active August 29, 2015 14:05
Proposed new G4OpRayleigh process for Geant4
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
@pgjones
pgjones / Simple.py
Last active August 29, 2015 14:14
Simple class for Andy
class Value(object):
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
array = []
for index in range(0, 360):
value = Value(10 * index, 20, 30)
@pgjones
pgjones / neteller_api_client.py
Created June 9, 2015 11:41
Example client class to transfer in and out of a Neteller wallet using the REST API
import logging
import requests
log = logging.getLogger(__name__)
# Currency without decimal places according to Neteller
NETELLER_NOT_DECIMAL = ['HUF', 'JPY']