Skip to content

Instantly share code, notes, and snippets.

@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>
/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 / 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;
@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;}
////////////////////////////////////////////////////////////////////////
/// \class RAT::DS::DataCleaningFlags
///
/// \brief This class contains the data cleaning flags for an event
///
/// \author R Bonventre <[email protected]>\n
/// Phil G Jones <[email protected]>
///
/// REVISION HISTORY:\n
/// 2013-10-16: P G Jones - New ds refactor. \n
@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();
}
@pgjones
pgjones / PMTDB.cc
Created October 15, 2013 11:52
Open the RATDB and extract PMT positions
#include <RAT/DB.hh>
#include <RAT/Log.hh>
#include <iostream>
using namespace std;
void RatDB()
{
RAT::Log::Init("/dev/null");
@pgjones
pgjones / Bi212Po212.mac
Created October 4, 2013 15:22
Standard Bi212Po212 macro with beta timing shape for alphas
/PhysicsList/OmitMuonicProcesses true
/rat/db/set GEO[scint] material "te_0p3_labppo_scintillator_Oct2012"
/rat/db/set OPTICS[te_0p3_labppo_scintillator_Oct2012] SCINTWAVEFORMalpha_value1 [ -4.6d, -18d, -156d,]
/rat/db/set OPTICS[te_0p3_labppo_scintillator_Oct2012] SCINTWAVEFORMalpha_value2 [ 0.71d, 0.22d, 0.07d,]
/run/initialize
##########EVENT LOOP############
@pgjones
pgjones / RatDB.cc
Created September 9, 2013 13:53
Load the ratdb in root. .L RatDB.cc+ RatDB();
#include <RAT/DB.hh>
#include <RAT/Log.hh>
#include <iostream>
using namespace std;
void RatDB()
{
RAT::Log::Init("/dev/null");
@pgjones
pgjones / ExtractClassifier.cc
Created July 26, 2013 11:11
Simple classification extraction example
////////////////////////////////////////////////////////
/// 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>