Berkeley Nuclear Data Software
Public Member Functions | Public Attributes | List of all members
TTOFWFFit Class Reference

this class is intended to work on TTOFEvent TTrees More...

#include <TTOFWFFit.h>

Inheritance diagram for TTOFWFFit:
Inheritance graph
[legend]
Collaboration diagram for TTOFWFFit:
Collaboration graph
[legend]

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...
 
- Public Member Functions inherited from PostProcBase< TTOFEvent >
 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

- Protected Attributes inherited from PostProcBase< TTOFEvent >
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...
 
TTOFEventm_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...
 

Detailed Description

this class is intended to work on TTOFEvent TTrees

Constructor & Destructor Documentation

◆ TTOFWFFit() [1/3]

TTOFWFFit::TTOFWFFit ( )

Nothing to do here

◆ TTOFWFFit() [2/3]

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

Here is the call graph for this function:

◆ TTOFWFFit() [3/3]

TTOFWFFit::TTOFWFFit ( std::string  a_fileName)
Here is the call graph for this function:

Member Function Documentation

◆ AnanyaWFTest()

TTree * TTOFWFFit::AnanyaWFTest ( std::string  a_outFileName,
int  a_numWF 
)

This runs wf fitting with AnanyaFitFunc.

Here is the call graph for this function:

◆ applyCutsToFile()

void TTOFWFFit::applyCutsToFile ( std::string  a_outFileName)

function to apply cuts to data in tree

looping over data and saving data that passes cuts

Here is the call graph for this function:

◆ compareFFTTemplates()

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

◆ compareFitResults() [1/2]

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" 
)

◆ compareFitResults() [2/2]

void TTOFWFFit::compareFitResults ( std::string  a_fitResultFile1,
std::string  a_fitResultFile2,
std::string  a_fitTreeName1,
std::string  a_fitTreeName2 
)

◆ developWFStatGraphs()

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

Here is the call graph for this function:

◆ doMultiFFT()

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!!

Here is the call graph for this function:

◆ doSingleFFT()

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

Here is the call graph for this function:

◆ drawAnanyaErfQuadWFTest()

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 
)
Here is the call graph for this function:

◆ drawAnanyaQuadWFTest() [1/2]

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 
)
Here is the call graph for this function:

◆ drawAnanyaQuadWFTest() [2/2]

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 
)
Here is the call graph for this function:

◆ drawAnanyaWFTest()

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 
)
Here is the call graph for this function:

◆ drawInvertedWFGraph()

void TTOFWFFit::drawInvertedWFGraph ( int  a_evNum,
bool  a_clearGraph = true 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawRandomInvertedWF()

void TTOFWFFit::drawRandomInvertedWF ( int  a_rangeStart,
int  a_rangeEnd 
)
Here is the call graph for this function:

◆ drawSingleQuadFitResult()

void TTOFWFFit::drawSingleQuadFitResult ( std::string  a_fitResultFile,
std::string  a_fitTreeName,
int  a_evNum 
)
Here is the call graph for this function:

◆ drawSingleTriFitResults()

void TTOFWFFit::drawSingleTriFitResults ( TTree *  a_fitResultTree,
int  a_wfNum 
)
Here is the call graph for this function:

◆ drawWFGraph()

void TTOFWFFit::drawWFGraph ( int  a_evNum,
bool  a_clearGraph = true 
)
Here is the call graph for this function:

◆ genWFHist()

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

Here is the call graph for this function:

◆ getInvertedWFTGraph()

TGraph * TTOFWFFit::getInvertedWFTGraph ( int  a_evNum)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWfFFT()

vector< std::complex< double > > TTOFWFFit::getWfFFT ( vector< double >  a_wfSeq)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWFTGraph()

TGraph * TTOFWFFit::getWFTGraph ( int  a_evNum)
Here is the call graph for this function:

◆ getWFVec()

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAnanyaErfQuadFitFunc()

TF1 * TTOFWFFit::loadAnanyaErfQuadFitFunc ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAnanyaFitFunc()

TF1 * TTOFWFFit::loadAnanyaFitFunc ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAnanyaQuadFitFunc()

TF1 * TTOFWFFit::loadAnanyaQuadFitFunc ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAnanyaQuadStatFitFunc()

TF1 * TTOFWFFit::loadAnanyaQuadStatFitFunc ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ passesCuts()

bool TTOFWFFit::passesCuts ( TTOFEvent a_event)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ plotFFT()

void TTOFWFFit::plotFFT ( vector< std::complex< double >> &  a_fHat)
Here is the caller graph for this function:

◆ readConfigFile()

void TTOFWFFit::readConfigFile ( std::string  a_fileName)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readCutFile()

void TTOFWFFit::readCutFile ( std::string  a_fileName)
Here is the call graph for this function:

◆ runWFFitting()

void TTOFWFFit::runWFFitting ( )

◆ seperateFitsToFile()

void TTOFWFFit::seperateFitsToFile ( std::string  a_outFileName)

function to seperate fit data

looping over data and saving data that passes cuts

Here is the call graph for this function:

◆ smoothWF()

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testSmoothing()

TGraph * TTOFWFFit::testSmoothing ( int  a_evNum,
int  a_windowSize,
int  a_iterations 
)

does smoothing actually work?

Here is the call graph for this function:

◆ testUnderThreshold()

void TTOFWFFit::testUnderThreshold ( int  iEv)

some test code for working out pulse processing

Here is the call graph for this function:

◆ upper_power_of_two()

unsigned long TTOFWFFit::upper_power_of_two ( unsigned long  v)
Here is the caller graph for this function:

Member Data Documentation

◆ m_cutInv

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

◆ m_cutState

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)


The documentation for this class was generated from the following files: