Berkeley Nuclear Data Software
|
#include <MesyDAQPostProcessing.h>
Public Member Functions | |
MesyDAQPostProcessing () | |
defualt constructor puts class into a working state More... | |
void | setOptVerbose (int a_verbosity) |
sets how much information to print while parsing More... | |
void | setWriteZeros (bool a_state) |
void | setEnforceBoardCount (bool a_state) |
int | addFile (std::string a_fileName) |
this function adds a file to the list of files to be processed More... | |
int | addRootFile (std::string a_filename) |
int | runIntegrityChecks () |
int | testCorrelations () |
void | buildCoinHists () |
void | buildDeltaTTestHist (int a_modID1, int a_modID2, int a_ch1, int a_ch2) |
int | accumulateBasicQuantities () |
build a series of histograms for More... | |
int | fileNotLoaded () |
tests if a file is loaded and prinst a message if not More... | |
TH1 * | buildCoincidenceTimeHistogram (int a_moduleNumber, int a_channel1, int a_channel2, double a_res) |
void | writeBasicHists (std::string a_filename) |
clears the map More... | |
void | writeAmplitudeHistsToAscii () |
vector< TH1 * > | buildSingleBoardCalibrationHistograms (std::vector< int > a_chList={}) |
int | ProcessEventToMesyDAQEv (MesyDAQEvent *a_daqEv, uint32_t *buffer, size_t a_size, int a_fileVersion) |
int | ProcessEventToMDPP16Events (std::vector< MDPP16Event > *a_evVector, uint32_t *a_buffer, size_t a_size, int a_fileVersion, std::ostream &a_stream=std::cout) |
int | loadNextEvent () |
this function adds a file to the list of files to be processed More... | |
int | readMDPPEvents (long int a_num, bool a_resEvVec=true) |
reads a series of sections into memory for processing More... | |
int | loadNextSectionToMDPP16Ev () |
int | processZipToMesyDAQEv (std::string a_fileName, std::string a_outFileName) |
int | processZipToMDPPEvent (std::string a_fileName, std::string a_outFileName) |
void | generateCloverCalibrationHists (std::vector< CloverInfo > a_config) |
std::vector< TH1 * > | getCloverCalibrationHists (const CloverInfo &a_config) |
void | generateWallTimeVAmpTree (ExperimentConfig a_configFile, std::vector< DetType > a_typeList, std::string a_outFileName, double a_downSampleScaler=-1) |
void | generateGlobalTimeVAmpTree (ExperimentConfig a_configFile, std::vector< DetType > a_typeList, std::string a_outFileName, double a_downSampleScaler=-1) |
void | generateOrganicScintillatorHists (std::string a_fileName) |
void | findCoincidences (std::vector< MDPP16Event > *a_evVec, std::vector< int > &a_singlesList, std::vector< std::vector< int >> &a_coinList, double a_coinWinNs, std::map< uint32_t, std::vector< uint16_t >> &a_RFTimes, bool a_accumulateRFs=true, bool a_includeSingleBoard=true) |
void | createTriggerVsWallTimeHist (std::string a_outFile, int a_moduleID=17, int a_threshold=10) |
void | investigateSections (std::vector< int > a_anticipatedBoards, std::vector< int > a_trigArray) |
void | retrieveBeamOnTimes (std::string a_inputFilename, std::string a_outputFilename) |
void | generateWallTimeTrigInterEventTime (std::string a_outputFileName, int a_numSections=100000) |
void | testCleanTrigArray (std::string a_outputFileName, int a_numSections, uint16_t a_boardID, uint16_t a_trigID, uint16_t a_desiredPeriod, uint16_t a_obsTrigPeriod, uint16_t a_jitterThreshold=2) |
std::ostream & | printFileStartTime (std::ostream &a_stream=std::cout) |
std::ostream & | printLoadedEvents (std::ostream &a_stream=std::cout) |
this functions prints the events from the m_evVec vector More... | |
std::ostream & | printLoadedSection (std::ostream &a_stream=std::cout) |
std::ostream & | printBadEvent (std::ostream &a_stream=std::cout) |
this function print bad event info More... | |
std::ostream & | printLastSection (std::ostream &a_stream=std::cout) |
Static Public Member Functions | |
static void | developCleanTrigArray (std::vector< uint16_t > &a_obsTrigs, std::vector< uint16_t > &a_resultArray, uint16_t a_desiredPeriod, uint16_t a_obsTrigPeriod, uint16_t a_jitterThreshold=2) |
Protected Member Functions | |
void | createBoardHists (int a_boardNumber) |
creates basic histograms for a board More... | |
vector< TH1 * > & | getBoardHistVector (int a_boardNumber) |
TH1 * | createSCPAmpHist (std::string a_name) |
TH1 * | createDeltaTDCHist (std::string a_name) |
int | openFile (std::string a_fileName) |
void | getRunStartTime (std::string a_fileName) |
void | getRunStopTime (std::string a_fileName) |
Protected Attributes | |
TChain * | m_trees |
for associating the trees from files More... | |
MesyDAQEvent * | m_currentEvent |
for storing the current event More... | |
std::vector< MDPP16Event > * | m_evVec |
used for storing a series of MDPP16 events; More... | |
std::vector< std::string > | m_loadedFiles |
for storing a list of loaded files More... | |
map< int, vector< TH1 * > > | m_basicHists |
bool | m_hasFile |
flag for wheter a file has been loaded More... | |
std::vector< std::string > | m_files |
used for storing list of files to be processed More... | |
int | m_fileIndex |
used to reference which of the current files in the list is open More... | |
int | m_fileVersion |
int | m_optVerbose |
bool | m_writeZeros |
bool | m_enforceBoardCount |
std::tm | m_lastFileTime |
std::tm | m_lastFileStopTime |
std::map< FailMode, int > | m_badEvCounter |
std::map< int, int > | m_sectionTypeCounter |
long int | m_sectionsRead |
DataBuffer * | m_dataBuffer |
from MVME More... | |
int | m_bufferSize |
DataBuffer * | m_lastDataBuffer |
int | m_lastBufferSize |
ListFile | m_listFileUtil |
From mesytec for storing the current opened file. More... | |
bool | m_fileOpen |
used to ensure file is open More... | |
bool | m_sectionRead |
std::default_random_engine | m_generator |
this class is intended as a base class for handling file io for file parsed by the MesyDAQParsing program
MesyDAQPostProcessing::MesyDAQPostProcessing | ( | ) |
defualt constructor puts class into a working state
int MesyDAQPostProcessing::accumulateBasicQuantities | ( | ) |
build a series of histograms for
int MesyDAQPostProcessing::addFile | ( | std::string | a_fileName | ) |
this function adds a file to the list of files to be processed
int MesyDAQPostProcessing::addRootFile | ( | std::string | a_filename | ) |
loads a file and associates the tree branch with internal memory for the event if a file has been loaded this checks to see if the call is a duplicitrous effort and if not adds the file to the TChain returns 0 when successful
TH1 * MesyDAQPostProcessing::buildCoincidenceTimeHistogram | ( | int | a_moduleNumber, |
int | a_channel1, | ||
int | a_channel2, | ||
double | a_res | ||
) |
build a time difference histogram in ns for a pair of channels within a module - was used to look at 511 keV coincidences for CFD par sweep
build a time difference histogram in ns for a pair of channels within a module
void MesyDAQPostProcessing::buildCoinHists | ( | ) |
void MesyDAQPostProcessing::buildDeltaTTestHist | ( | int | a_modID1, |
int | a_modID2, | ||
int | a_ch1, | ||
int | a_ch2 | ||
) |
this function write a file called timingtest.root containing a TTree with time differences and amplitudes of the two channels on either the seperate or same module if specified by modIDN it aslo save a time difference histrogram containing the raw time differences between the channels. It assumes that the boards are being externally triggered using the external trigger as a sync signal
vector< TH1 * > MesyDAQPostProcessing::buildSingleBoardCalibrationHistograms | ( | std::vector< int > | a_chList = {} | ) |
this function is intended to create calibration histograms when working with a single module and coincidences are constrained within a gate. If no channels are given it will produce histograms for all channels encountered
|
protected |
creates basic histograms for a board
pulse amplitude time pulse shape
|
protected |
creates a historgram with the appropriate bounds and axis lables for the difference in TDC values for a pair of channels
|
protected |
creates a histogram with appropriate bounds and axis labels for the amplitude range of the SCP firmware
void MesyDAQPostProcessing::createTriggerVsWallTimeHist | ( | std::string | a_outFile, |
int | a_moduleID = 17 , |
||
int | a_threshold = 10 |
||
) |
creates a histogram of system triggers with respect to wall time; or a quick way to get count rate over time to determine when cyclotron is on or off
|
static |
this function is used to clean a trigger array from mulitple triggering problems. It requires that you know what the periodicity of the desired trigger is known, and which of the sub-periods you would like to start with every time. It searches for a trigger where the next event occurs at the given sub period, then constructs an array with the correct periodicity within the observed range of the given array. It then tests the individual observed triggers against the constructed array, only keeping ones that fall within the specified sample tolerance. a_obsTrigs is the raw trigger array a_resultArray stores the resulting subset of the trigger array a_desired period is the anticipated period of the trigger a_obsTrig period is the subperiod to start the calculation from !!!!!!! THIS ASSUMES YOUR TRIG ARRAY IS SORTED !!!!!!!!!!!!! !!!!!!! THIS ASSUMES YOUR TRIG ARRAY IS > size 2 !!!!!!!!!!!!! !!!!!!! THIS ASSUMES YOUR RESULT ARRAY IS CLEAR !!!!!!!!!!!!!
this function is used to clean a trigger array from mulitple triggering problems. It requires that you know what the periodicity of the desired trigger is known, and which of the sub-periods you would like to start with every time. It searches for a trigger where the next event occurs at the given sub period, then constructs an array with the correct periodicity within the observed range of the given array. It then tests the individual observed triggers against the constructed array, only keeping ones that fall within the specified sample tolerance. a_obsTrigs is the raw trigger array a_resultArray stores the resulting subset of the trigger array a_desired period is the anticipated period of the trigger a_obsTrig period is the subperiod to start the calculation from
int MesyDAQPostProcessing::fileNotLoaded | ( | ) |
tests if a file is loaded and prinst a message if not
void MesyDAQPostProcessing::findCoincidences | ( | std::vector< MDPP16Event > * | a_evVec, |
std::vector< int > & | a_singlesList, | ||
std::vector< std::vector< int >> & | a_coinList, | ||
double | a_coinWinNs, | ||
std::map< uint32_t, std::vector< uint16_t >> & | a_RFTimes, | ||
bool | a_accumulateRFs = true , |
||
bool | a_includeSingleBoard = true |
||
) |
this function looks for events included in the supplied event vector for situations where there are at least two hits within the given coincidence window
this function looks for events included in the supplied event vector for situations where there are at least two hits within the given coincidence window this function looks for events included in the supplied event vector for situations where there are at least two hits within the given coincidence window
add RF times
!!!!!!!!!!needs to be updated for longer windows than a_coinWinNs!!!!!!!
void MesyDAQPostProcessing::generateCloverCalibrationHists | ( | std::vector< CloverInfo > | a_config | ) |
generates histograms for the clover energy and interelement time calibrations
need a list of the channels in the event
maybe need the modID?
!!!!!!!!HANDLE BGO COINCIDENCES!!!!!!!!!!!!!!!
void MesyDAQPostProcessing::generateGlobalTimeVAmpTree | ( | ExperimentConfig | a_configFile, |
std::vector< DetType > | a_typeList, | ||
std::string | a_outFileName, | ||
double | a_downSampleScaler = -1 |
||
) |
This function does the same as generateWallTimeVAmpTree, but does it with global time rather than wall time.
void MesyDAQPostProcessing::generateOrganicScintillatorHists | ( | std::string | a_fileName | ) |
This funciton generates filled calibration histograms from the organic scintillators
void MesyDAQPostProcessing::generateWallTimeTrigInterEventTime | ( | std::string | a_outputFileName, |
int | a_numSections = 100000 |
||
) |
this function takes and generates a tree used for investigating the behavior of a repetitive trigger within the gate. It only parses the first N event specified as an argument. The tree has the following structure wallTime unix time of the event iETime time since the last trigger of a given trigger obsrvation boardID the id of the board observing the trigger triggerID the trigger number from the board
void MesyDAQPostProcessing::generateWallTimeVAmpTree | ( | ExperimentConfig | a_config, |
std::vector< DetType > | a_typeList, | ||
std::string | a_outFileName, | ||
double | a_downSampleScaler = -1 |
||
) |
this function is inteded to enable the ability to develop a time dependent gain calibrations for detectors where it is neccesary it produces a file with a trees with basic types. for each class of specified detectors. Detectors to consider are specified through the detector list, and a downsample scaler allows for writing a reduced selection of events. The downsampling is handled statistically If the down sample scaler is set to 100 the probability of writing any single event is 1/100. the tree variables for non-segmented detectors are int8_t det id int16_t amp, the raw recorded amplitue int32_t time, the wall clock time of the event as a seconds since epoch segmented detectors additionally get int8_t element id/leaf id for clovers
|
protected |
returns a reference to the board histograms if present if not present creates them
std::vector< TH1 * > MesyDAQPostProcessing::getCloverCalibrationHists | ( | const CloverInfo & | a_config | ) |
returns a set of unfilled calibration histograms for a clover ID [0..3] = raw amplitude histograms [4] = leaf 0 1 time differences [5] = leaf 0 2 time differences [6] = leaf 0 3 time differences [7] = leaf 0 bgo 0 time differences [8] = leaf 0 bgo 1 time differences [7+nbgo] = leaf 0 bgo n time differences
|
protected |
|
protected |
void MesyDAQPostProcessing::investigateSections | ( | std::vector< int > | a_anticipatedBoards, |
std::vector< int > | a_trigArray | ||
) |
this creates a tree with information about the state of the sections being created by the DAQ.
create a tree
create maps for storing the information which will let us have a dynamic tree based on inputs
initalize the maps to assume failure
int MesyDAQPostProcessing::loadNextEvent | ( | ) |
this function adds a file to the list of files to be processed
this function process a section from the current zip file and
int MesyDAQPostProcessing::loadNextSectionToMDPP16Ev | ( | ) |
this function parses the next mesytec section into MDPP16 events and stores them in the m_evVec data member
|
protected |
std::ostream & MesyDAQPostProcessing::printBadEvent | ( | std::ostream & | a_stream = std::cout | ) |
this function print bad event info
std::ostream & MesyDAQPostProcessing::printFileStartTime | ( | std::ostream & | a_stream = std::cout | ) |
std::ostream & MesyDAQPostProcessing::printLastSection | ( | std::ostream & | a_stream = std::cout | ) |
std::ostream & MesyDAQPostProcessing::printLoadedEvents | ( | std::ostream & | a_stream = std::cout | ) |
this functions prints the events from the m_evVec vector
std::ostream & MesyDAQPostProcessing::printLoadedSection | ( | std::ostream & | a_stream = std::cout | ) |
this function prints the last section from the stored data buffer without influencing other data structures
int MesyDAQPostProcessing::ProcessEventToMDPP16Events | ( | std::vector< MDPP16Event > * | a_evVector, |
uint32_t * | a_buffer, | ||
size_t | a_size, | ||
int | a_fileVersion, | ||
std::ostream & | a_stream = std::cout |
||
) |
this function processes a mesytec data section adding MDPP16Events to the supplied vector if opt verbose is set to true diagnostic info will be printed the supplied stream
the top 4 bits of the header should be 0b0100 or 4
int MesyDAQPostProcessing::ProcessEventToMesyDAQEv | ( | MesyDAQEvent * | a_daqEv, |
uint32_t * | buffer, | ||
size_t | a_size, | ||
int | a_fileVersion | ||
) |
this function process a mesytec data section stored in buffer and fills the assigned MesyDAQEvent with the data
int MesyDAQPostProcessing::processZipToMDPPEvent | ( | std::string | a_fileName, |
std::string | a_outFileName | ||
) |
int MesyDAQPostProcessing::processZipToMesyDAQEv | ( | std::string | a_fileName, |
std::string | a_outFileName | ||
) |
int MesyDAQPostProcessing::readMDPPEvents | ( | long int | a_num, |
bool | a_resEvVec = true |
||
) |
reads a series of sections into memory for processing
void MesyDAQPostProcessing::retrieveBeamOnTimes | ( | std::string | a_inputFilename, |
std::string | a_outputFilename | ||
) |
retrieves beam on times from createTriggerVsWallTimeHist root file and outputs to JSON.
int MesyDAQPostProcessing::runIntegrityChecks | ( | ) |
constructs histograms that run data integrity checks to ensure both the instrumentation and parse are working as expected this produces a file with a series of histograms
void MesyDAQPostProcessing::setEnforceBoardCount | ( | bool | a_state | ) |
void MesyDAQPostProcessing::setOptVerbose | ( | int | a_verbosity | ) |
sets how much information to print while parsing
void MesyDAQPostProcessing::setWriteZeros | ( | bool | a_state | ) |
sets whether or not to conisder events with sections that have not adc or tdc values
void MesyDAQPostProcessing::testCleanTrigArray | ( | std::string | a_outputFileName, |
int | a_numSections, | ||
uint16_t | a_boardID, | ||
uint16_t | a_trigID, | ||
uint16_t | a_desiredPeriod, | ||
uint16_t | a_obsTrigPeriod, | ||
uint16_t | a_jitterThreshold = 2 |
||
) |
this function tests the cleaning of the trigger array for a given board and set of paramters
create storage for the cleaned array
int MesyDAQPostProcessing::testCorrelations | ( | ) |
constructs histograms that run data integrity checks to ensure both the instrumentation and parse are working as expected this produces a file with a series of histograms
void MesyDAQPostProcessing::writeAmplitudeHistsToAscii | ( | ) |
this function dumps a series of amplitude hists for the boards present the naming convention is amp_[board#]_[channel#].dat each row of the file corresponds to a bin of the amplitude histograms starting with 0-1. if no counts are present in the histogram a file will not be written
this function dumps a series of amplitude hists for the boards present the naming convention is amp_[board#]_[channel#].dat each row of the file corresponds to a bin of the amplitude histograms starting with 0-1.
void MesyDAQPostProcessing::writeBasicHists | ( | std::string | a_filename | ) |
clears the map
writes the current map of basic hists to a tfile and
|
protected |
|
protected |
|
protected |
|
protected |
for storing the current event
|
protected |
from MVME
|
protected |
|
protected |
used for storing a series of MDPP16 events;
|
protected |
used to reference which of the current files in the list is open
|
protected |
used to ensure file is open
|
protected |
used for storing list of files to be processed
|
protected |
|
protected |
|
protected |
flag for wheter a file has been loaded
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
From mesytec for storing the current opened file.
|
protected |
for storing a list of loaded files
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
for associating the trees from files
|
protected |