Berkeley Nuclear Data Software
|
this class is intended to work on TTOFEvent TTrees More...
#include <TTOFWFFit.h>
Public Member Functions | |
TTOFWFFit () | |
TTOFWFFit (int a_fitFunc) | |
TTOFWFFit (std::string a_fileName) | |
void | readConfigFile (std::string a_fileName) |
void | readCutFile (std::string a_fileName) |
void | drawInvertedWFGraph (int a_evNum, bool a_clearGraph=true) |
TGraph * | getInvertedWFTGraph (int a_evNum) |
void | drawWFGraph (int a_evNum, bool a_clearGraph=true) |
TGraph * | getWFTGraph (int a_evNum) |
void | drawRandomInvertedWF (int a_rangeStart, int a_rangeEnd) |
void | applyCutsToFile (std::string a_outFileName) |
function to apply cuts to data in tree More... | |
void | seperateFitsToFile (std::string a_outFileName) |
function to seperate fit data More... | |
void | runWFFitting () |
bool | passesCuts (TTOFEvent *a_event) |
void | drawAnanyaWFTest (string a_WFFile, string a_WFName, double norm_1, double tau1_1, double tau2_1, double norm_2, double tau1_2, double tau2_2, double norm_3, double tau1_3, double tau2_3, double dt, bool a_drawAllExp=false) |
void | drawAnanyaQuadWFTest (string a_WFFile, string a_WFName, double norm_1, double tau1_1, double tau2_1, double norm_2, double tau1_2, double tau2_2, double norm_3, double tau1_3, double tau2_3, double norm_4, double tau1_4, double tau2_4, double dt, bool a_drawAllExp=true, bool a_drawResidPlot=false) |
void | drawAnanyaQuadWFTest (int a_evNum, double norm_1, double tau1_1, double tau2_1, double norm_2, double tau1_2, double tau2_2, double norm_3, double tau1_3, double tau2_3, double norm_4, double tau1_4, double tau2_4, double dt, bool a_drawAllExp=true) |
void | drawAnanyaErfQuadWFTest (string a_WFFile, string a_WFName, double norm_1, double tau1_1, double tau2_1, double norm_2, double tau1_2, double tau2_2, double norm_3, double tau1_3, double tau2_3, double norm_4, double tau1_4, double tau2_4, double dt, bool a_drawAllExp=true) |
TTree * | AnanyaWFTest (std::string a_outFileName, int a_numWF) |
This runs wf fitting with AnanyaFitFunc. More... | |
void | drawSingleQuadFitResult (std::string a_fitResultFile, std::string a_fitTreeName, int a_evNum) |
void | drawSingleTriFitResults (TTree *a_fitResultTree, int a_wfNum) |
TF1 * | loadAnanyaFitFunc () |
TF1 * | loadAnanyaQuadFitFunc () |
TF1 * | loadAnanyaQuadStatFitFunc () |
TF1 * | loadAnanyaErfQuadFitFunc () |
void | compareFitResults (std::string a_fitResultFile1, std::string a_fitResultFile2, std::string a_fitTreeName1, std::string a_fitTreeName2) |
void | compareFitResults (std::string a_fitResultFile1, std::string a_fitResultFile2, std::string a_fitResultFile3, std::string a_fitTreeName1="fitTreeResults", std::string a_fitTreeName2="fitTreeResults", std::string a_fitTreeName3="fitTreeResults") |
TH2 * | developWFStatGraphs (std::string a_outFile="wfStatGraphs.root", bool a_drawGraphs=false, double a_baseline=-1., double a_startSampleOffset=5) |
TH2 * | genWFHist (bool a_drawGraphs=false, double a_baseline=-1., double a_startSampleOffset=5, std::string a_fileName="wfStats.root") |
vector< double > | smoothWF (int a_evNum, int a_windowSize, int a_replace, int a_draw=1) |
TGraph * | testSmoothing (int a_evNum, int a_windowSize, int a_iterations) |
does smoothing actually work? More... | |
vector< double > | getWFVec (int a_evNum, int a_range=0, int a_draw=1) |
vector< std::complex< double > > | getWfFFT (vector< double > a_wfSeq) |
unsigned long | upper_power_of_two (unsigned long v) |
void | plotFFT (vector< std::complex< double >> &a_fHat) |
void | doSingleFFT (int a_evNum, int a_range=0, int a_smooth=0) |
void | doMultiFFT (int a_numWF, int a_smooth, int a_writeToFile=0, int a_range=0) |
void | compareFFTTemplates (std::string a_FFTFileName1, std::string a_FFTFileName2, int a_yProjBin) |
void | testUnderThreshold (int iEv) |
some test code for working out pulse processing More... | |
![]() | |
PostProcBase () | |
defualt constructor puts class into a working state More... | |
virtual int | addFile (string a_filename) |
virtual int | addFilesFromDirectory (string a_dir, string a_ext) |
virtual int | loadEvent (int a_eventNumber) |
loads a specified event into memory More... | |
virtual int | fileNotLoaded () |
tests if a file is loaded and prinst a message if not More... | |
virtual int | clearFileState () |
virtual std::ostream & | printState (std::ostream &a_stream=std::cout) |
virtual | ~PostProcBase () |
TChain * | getTrees () |
danger danger, use this if you know what you are doing. More... | |
Public Attributes | |
std::map< string, bool > | m_cutState |
std::map< string, bool > | m_cutInv |
Additional Inherited Members | |
![]() | |
TChain * | m_trees |
for associating the trees from files More... | |
string | m_treeName |
for storing the name of the tree More... | |
string | m_branchName |
for storing the name of the branch More... | |
TTOFEvent * | m_currentEvent |
for storing the current event More... | |
vector< string > | m_loadedFiles |
for storing a list of loaded files More... | |
bool | m_hasFile |
flag for wheter a file has been loaded More... | |
this class is intended to work on TTOFEvent TTrees
TTOFWFFit::TTOFWFFit | ( | ) |
Nothing to do here
TTOFWFFit::TTOFWFFit | ( | int | a_fitFunc | ) |
Depends on which fit function you want to be able to access a_fitFunc = 3 --> triple bi-exp, a_fitFunc = 4 --> quad bi-exp
TTOFWFFit::TTOFWFFit | ( | std::string | a_fileName | ) |
TTree * TTOFWFFit::AnanyaWFTest | ( | std::string | a_outFileName, |
int | a_numWF | ||
) |
This runs wf fitting with AnanyaFitFunc.
void TTOFWFFit::applyCutsToFile | ( | std::string | a_outFileName | ) |
function to apply cuts to data in tree
looping over data and saving data that passes cuts
void TTOFWFFit::compareFFTTemplates | ( | std::string | a_FFTFileName1, |
std::string | a_FFTFileName2, | ||
int | a_yProjBin | ||
) |
It needs two .root files with TH2 called "FFTTemplate" --> made to use after calling do MultiFFT If you have called doMultiFFT w/ a_writeToFile=1, then give it the file names and the bin # who's y-Proj you want to see
void TTOFWFFit::compareFitResults | ( | std::string | a_fitResultFile1, |
std::string | a_fitResultFile2, | ||
std::string | a_fitResultFile3, | ||
std::string | a_fitTreeName1 = "fitTreeResults" , |
||
std::string | a_fitTreeName2 = "fitTreeResults" , |
||
std::string | a_fitTreeName3 = "fitTreeResults" |
||
) |
void TTOFWFFit::compareFitResults | ( | std::string | a_fitResultFile1, |
std::string | a_fitResultFile2, | ||
std::string | a_fitTreeName1, | ||
std::string | a_fitTreeName2 | ||
) |
TH2 * TTOFWFFit::developWFStatGraphs | ( | std::string | a_outFile = "wfStatGraphs.root" , |
bool | a_drawGraphs = false , |
||
double | a_baseline = -1. , |
||
double | a_startSampleOffset = 5 |
||
) |
This function assumes that you have done all the cuts you want and plots several relevant graphs Generates a 2DHist of all waveforms in File (samples on the x axis, Normalized Amplitudes on the y-axis) Generates a median waveform Generates a modal waveform Calls developWFTemplate() to get an average waveform Plots all three statistical waveforms on the same graph if a baseline is specified it is used instead of attempting to estimate it from the data
get number of samples in WF
premature optimazation is the root of all evil reserve memory to avoid memory thrashing
this should never happen given the current processing mode
void TTOFWFFit::doMultiFFT | ( | int | a_numWF, |
int | a_smooth, | ||
int | a_writeToFile = 0 , |
||
int | a_range = 0 |
||
) |
a_smooth = 0 --> no smoothing to the WF, a_smooth = 1 --> the WF will be smoothed a_writeToFile=1 --> Writes the TH2 FFT Template to a ROOT File, a_writeToFile=0 (default) does not write The meaning of a_range changes depending on a_smooth If a_smooth=0 --> a_range=the sample up to which to get the Vector Seting a_range = 0 will take the full WF If a_smooth=1 --> a_range=the number at which you want to start replacing w/ smoothed WF
!Note, the smoothing filter size is hard-coded here!!
void TTOFWFFit::doSingleFFT | ( | int | a_evNum, |
int | a_range = 0 , |
||
int | a_smooth = 0 |
||
) |
a_range = the sample up to which to get the Vector, Seting a_range = 0 will take the full WF
void TTOFWFFit::drawAnanyaErfQuadWFTest | ( | string | a_WFFile, |
string | a_WFName, | ||
double | norm_1, | ||
double | tau1_1, | ||
double | tau2_1, | ||
double | norm_2, | ||
double | tau1_2, | ||
double | tau2_2, | ||
double | norm_3, | ||
double | tau1_3, | ||
double | tau2_3, | ||
double | norm_4, | ||
double | tau1_4, | ||
double | tau2_4, | ||
double | dt, | ||
bool | a_drawAllExp = true |
||
) |
void TTOFWFFit::drawAnanyaQuadWFTest | ( | int | a_evNum, |
double | norm_1, | ||
double | tau1_1, | ||
double | tau2_1, | ||
double | norm_2, | ||
double | tau1_2, | ||
double | tau2_2, | ||
double | norm_3, | ||
double | tau1_3, | ||
double | tau2_3, | ||
double | norm_4, | ||
double | tau1_4, | ||
double | tau2_4, | ||
double | dt, | ||
bool | a_drawAllExp = true |
||
) |
void TTOFWFFit::drawAnanyaQuadWFTest | ( | string | a_WFFile, |
string | a_WFName, | ||
double | norm_1, | ||
double | tau1_1, | ||
double | tau2_1, | ||
double | norm_2, | ||
double | tau1_2, | ||
double | tau2_2, | ||
double | norm_3, | ||
double | tau1_3, | ||
double | tau2_3, | ||
double | norm_4, | ||
double | tau1_4, | ||
double | tau2_4, | ||
double | dt, | ||
bool | a_drawAllExp = true , |
||
bool | a_drawResidPlot = false |
||
) |
void TTOFWFFit::drawAnanyaWFTest | ( | string | a_WFFile, |
string | a_WFName, | ||
double | norm_1, | ||
double | tau1_1, | ||
double | tau2_1, | ||
double | norm_2, | ||
double | tau1_2, | ||
double | tau2_2, | ||
double | norm_3, | ||
double | tau1_3, | ||
double | tau2_3, | ||
double | dt, | ||
bool | a_drawAllExp = false |
||
) |
void TTOFWFFit::drawInvertedWFGraph | ( | int | a_evNum, |
bool | a_clearGraph = true |
||
) |
void TTOFWFFit::drawRandomInvertedWF | ( | int | a_rangeStart, |
int | a_rangeEnd | ||
) |
void TTOFWFFit::drawSingleQuadFitResult | ( | std::string | a_fitResultFile, |
std::string | a_fitTreeName, | ||
int | a_evNum | ||
) |
void TTOFWFFit::drawSingleTriFitResults | ( | TTree * | a_fitResultTree, |
int | a_wfNum | ||
) |
void TTOFWFFit::drawWFGraph | ( | int | a_evNum, |
bool | a_clearGraph = true |
||
) |
TH2 * TTOFWFFit::genWFHist | ( | bool | a_drawGraphs = false , |
double | a_baseline = -1. , |
||
double | a_startSampleOffset = 5 , |
||
std::string | a_fileName = "wfStats.root" |
||
) |
this function takes the loaded waveforms and creates a TH2 of their history with the start point being the subsample interpolated result
get number of samples in WF
this should never happen given the current processing mode
using floor here so that the offset is meaningfull
TGraph * TTOFWFFit::getInvertedWFTGraph | ( | int | a_evNum | ) |
vector< std::complex< double > > TTOFWFFit::getWfFFT | ( | vector< double > | a_wfSeq | ) |
TGraph * TTOFWFFit::getWFTGraph | ( | int | a_evNum | ) |
vector< double > TTOFWFFit::getWFVec | ( | int | a_evNum, |
int | a_range = 0 , |
||
int | a_draw = 1 |
||
) |
a_evNum = event number that you want to smooth a_windowSize = the size of the square wave for smoothing a_replace = the number at which you want to start replacing w/ smoothed WF a_draw = whether to draw the three graphs or not (a=1 is draw (default), all else will not draw) If you do not want to smooth the waveform before doing the FFT, you need to call this function
TF1 * TTOFWFFit::loadAnanyaErfQuadFitFunc | ( | ) |
TF1 * TTOFWFFit::loadAnanyaFitFunc | ( | ) |
TF1 * TTOFWFFit::loadAnanyaQuadFitFunc | ( | ) |
TF1 * TTOFWFFit::loadAnanyaQuadStatFitFunc | ( | ) |
bool TTOFWFFit::passesCuts | ( | TTOFEvent * | a_event | ) |
void TTOFWFFit::plotFFT | ( | vector< std::complex< double >> & | a_fHat | ) |
void TTOFWFFit::readConfigFile | ( | std::string | a_fileName | ) |
void TTOFWFFit::readCutFile | ( | std::string | a_fileName | ) |
void TTOFWFFit::runWFFitting | ( | ) |
void TTOFWFFit::seperateFitsToFile | ( | std::string | a_outFileName | ) |
function to seperate fit data
looping over data and saving data that passes cuts
vector< double > TTOFWFFit::smoothWF | ( | int | a_evNum, |
int | a_windowSize, | ||
int | a_replace, | ||
int | a_draw = 1 |
||
) |
This function applies smoothing filter to waveform (requires addFile() before) Returns a vector of the combined vector (where elements a_replace and after are smoothed) Plots a TCanvas with three different TGraphs (if a_draw=1): Original WF, smoothed waveform, and Orig wf w/anything past the set point replaced w/ smoothed WF
TGraph * TTOFWFFit::testSmoothing | ( | int | a_evNum, |
int | a_windowSize, | ||
int | a_iterations | ||
) |
does smoothing actually work?
void TTOFWFFit::testUnderThreshold | ( | int | iEv | ) |
some test code for working out pulse processing
unsigned long TTOFWFFit::upper_power_of_two | ( | unsigned long | v | ) |
std::map<string, bool> TTOFWFFit::m_cutInv |
if the cut state is set and the cutInv is 0 the test is for passesCut if the cut state is set and the cutInv is 1 the test is for !passesCut
std::map<string, bool> TTOFWFFit::m_cutState |
this map reflects the possible cuts that can be applied to the data they are inactive by default. Currenty managed cuts are targetPSDNeutron (2D cut) startPSDNeutron (2D cut) targetPSDGamma (2D cut) startPSDGamma (2D cut) minStartLight targetLight coinTOF neutronEnergy targLightVsCoinTOF (2D cut)