#include <HPDNoiseReader.h>
Public Types | |
typedef int | Handle |
Public Member Functions | |
std::vector< std::string > | allNames () const |
all HPD instances in the library | |
float | dischargeRate (Handle fHandle) const |
discharge rate for the instance | |
float | emissionRate (Handle fHandle) const |
ithermal/field emission rate for the instance | |
void | getEntry (Handle fHandle, HPDNoiseData **fData) |
retrive one entry from the sequentially | |
void | getEntry (Handle fHandle, unsigned long fEntry, HPDNoiseData **fData) |
retrive one entry from the library directly | |
Handle | getHandle (const std::string &fName) |
get handle to access data for one HPD instance | |
HPDNoiseReader (const std::string &fFileName) | |
float | ionFeedbackFirstPeakRate (Handle fHandle) const |
ionfeedback rate for the instance | |
float | ionFeedbackSecondPeakRate (Handle fHandle) const |
unsigned long | totalEntries (Handle fHandle) const |
total number of noise events for the HPD instance in the library | |
bool | valid (Handle fHandle) const |
test if handle is valid | |
~HPDNoiseReader () | |
Private Member Functions | |
void | grabEntry (Handle fHandle, unsigned long fEntry) |
HPDNoiseReader (const HPDNoiseReader &) | |
HPDNoiseReader & | operator= (const HPDNoiseReader &) |
Private Attributes | |
HPDNoiseData * | mBuffer |
std::vector< size_t > | mCurrentEntry |
std::vector< float > | mDischargeRate |
std::vector< float > | mElectronEmissionRate |
TFile * | mFile |
std::vector< float > | mIonFeedbackFirstPeakRate |
std::vector< float > | mIonFeedbackSecondPeakRate |
std::vector< TTree * > | mTrees |
Definition at line 18 of file HPDNoiseReader.h.
typedef int HPDNoiseReader::Handle |
Definition at line 20 of file HPDNoiseReader.h.
HPDNoiseReader::HPDNoiseReader | ( | const std::string & | fFileName | ) |
Definition at line 19 of file HPDNoiseReader.cc.
References HPDNoiseDataCatalog::allNames(), validate_alignment_devdb10_cfg::catalog, dtNoiseDBValidation_cfg::cerr, HPDNoiseDataCatalog::getDischargeRate(), HPDNoiseDataCatalog::getElectronEmissionRate(), HPDNoiseDataCatalog::getIonFeedbackFirstPeakRate(), HPDNoiseDataCatalog::getIonFeedbackSecondPeakRate(), i, mBuffer, mCurrentEntry, mDischargeRate, mElectronEmissionRate, mFile, mIonFeedbackFirstPeakRate, mIonFeedbackSecondPeakRate, mTrees, h::names, HPDNoiseDataCatalog::objectName(), and diffTreeTool::tree.
{ mFile = new TFile (fFileName.c_str(), "READ"); mBuffer = new HPDNoiseData (); HPDNoiseDataCatalog* catalog; mFile->GetObject (HPDNoiseDataCatalog::objectName(), catalog); if (catalog) { // initiate trees const std::vector<std::string> names = catalog->allNames(); for (size_t i = 0; i < names.size(); ++i) { TTree* tree = (TTree*) mFile->Get (names[i].c_str()); if (tree) { mTrees.push_back (tree); mDischargeRate.push_back (catalog->getDischargeRate (i)); mIonFeedbackFirstPeakRate.push_back(catalog->getIonFeedbackFirstPeakRate(i)); mIonFeedbackSecondPeakRate.push_back(catalog->getIonFeedbackSecondPeakRate(i)); mElectronEmissionRate.push_back(catalog->getElectronEmissionRate(i)); mCurrentEntry.push_back (0); } else { std::cerr << "HPDNoiseReader::HPDNoiseReader-> Can not open tree " << names[i] << " in file " << fFileName << std::endl; } } } else { std::cerr << "HPDNoiseReader::HPDNoiseReader-> Can not open catalog infile " << fFileName << std::endl; } }
HPDNoiseReader::~HPDNoiseReader | ( | ) |
HPDNoiseReader::HPDNoiseReader | ( | const HPDNoiseReader & | ) | [private] |
std::vector< std::string > HPDNoiseReader::allNames | ( | ) | const |
all HPD instances in the library
Definition at line 56 of file HPDNoiseReader.cc.
References i, mTrees, and query::result.
Referenced by HPDNoiseLibraryReader::HPDNoiseLibraryReader().
float HPDNoiseReader::dischargeRate | ( | Handle | fHandle | ) | const |
discharge rate for the instance
Definition at line 69 of file HPDNoiseReader.cc.
References mDischargeRate, and valid().
Referenced by HPDNoiseLibraryReader::fillRates().
{ if (!valid (fHandle)) return 0; return mDischargeRate[fHandle]; }
float HPDNoiseReader::emissionRate | ( | Handle | fHandle | ) | const |
ithermal/field emission rate for the instance
Definition at line 81 of file HPDNoiseReader.cc.
References mElectronEmissionRate, and valid().
{ if (!valid (fHandle)) return 0; return mElectronEmissionRate[fHandle]; }
void HPDNoiseReader::getEntry | ( | Handle | fHandle, |
HPDNoiseData ** | fData | ||
) |
retrive one entry from the sequentially
Definition at line 99 of file HPDNoiseReader.cc.
References grabEntry(), mBuffer, mCurrentEntry, totalEntries(), and valid().
Referenced by HPDNoiseLibraryReader::getNoiseData().
{ if (!valid (fHandle)) return; unsigned int entry = mCurrentEntry [fHandle]; if (++entry >= totalEntries (fHandle)) entry = 0; // roll over grabEntry (fHandle, entry); *fData = mBuffer; }
void HPDNoiseReader::getEntry | ( | Handle | fHandle, |
unsigned long | fEntry, | ||
HPDNoiseData ** | fData | ||
) |
retrive one entry from the library directly
Definition at line 107 of file HPDNoiseReader.cc.
References grabEntry(), and mBuffer.
HPDNoiseReader::Handle HPDNoiseReader::getHandle | ( | const std::string & | fName | ) |
get handle to access data for one HPD instance
Definition at line 62 of file HPDNoiseReader.cc.
Referenced by HPDNoiseLibraryReader::fillRates(), and HPDNoiseLibraryReader::getNoiseData().
void HPDNoiseReader::grabEntry | ( | Handle | fHandle, |
unsigned long | fEntry | ||
) | [private] |
Definition at line 91 of file HPDNoiseReader.cc.
References HPDNoiseData::branchName(), mBuffer, mCurrentEntry, mTrees, and valid().
Referenced by getEntry().
{ if (!valid (fHandle)) return; TBranch* branch = mTrees[fHandle]->GetBranch (HPDNoiseData::branchName()); branch->SetAddress (&mBuffer); branch->GetEntry (fEntry); mCurrentEntry [fHandle] = fEntry; }
float HPDNoiseReader::ionFeedbackFirstPeakRate | ( | Handle | fHandle | ) | const |
ionfeedback rate for the instance
Definition at line 73 of file HPDNoiseReader.cc.
References mIonFeedbackFirstPeakRate, and valid().
Referenced by HPDNoiseLibraryReader::fillRates().
{ if (!valid (fHandle)) return 0; return mIonFeedbackFirstPeakRate[fHandle]; }
float HPDNoiseReader::ionFeedbackSecondPeakRate | ( | Handle | fHandle | ) | const |
Definition at line 77 of file HPDNoiseReader.cc.
References mIonFeedbackSecondPeakRate, and valid().
Referenced by HPDNoiseLibraryReader::fillRates().
{ if (!valid (fHandle)) return 0; return mIonFeedbackSecondPeakRate[fHandle]; }
HPDNoiseReader& HPDNoiseReader::operator= | ( | const HPDNoiseReader & | ) | [private] |
unsigned long HPDNoiseReader::totalEntries | ( | Handle | fHandle | ) | const |
total number of noise events for the HPD instance in the library
Definition at line 86 of file HPDNoiseReader.cc.
References mTrees, and valid().
Referenced by getEntry(), and HPDNoiseLibraryReader::getNoiseData().
bool HPDNoiseReader::valid | ( | Handle | fHandle | ) | const [inline] |
test if handle is valid
Definition at line 29 of file HPDNoiseReader.h.
Referenced by dischargeRate(), emissionRate(), HPDNoiseLibraryReader::fillRates(), getEntry(), HPDNoiseLibraryReader::getNoiseData(), grabEntry(), ionFeedbackFirstPeakRate(), ionFeedbackSecondPeakRate(), and totalEntries().
{return fHandle >= 0;}
HPDNoiseData* HPDNoiseReader::mBuffer [private] |
Definition at line 56 of file HPDNoiseReader.h.
Referenced by getEntry(), grabEntry(), HPDNoiseReader(), and ~HPDNoiseReader().
std::vector<size_t> HPDNoiseReader::mCurrentEntry [private] |
Definition at line 55 of file HPDNoiseReader.h.
Referenced by getEntry(), grabEntry(), and HPDNoiseReader().
std::vector<float> HPDNoiseReader::mDischargeRate [private] |
Definition at line 51 of file HPDNoiseReader.h.
Referenced by dischargeRate(), and HPDNoiseReader().
std::vector<float> HPDNoiseReader::mElectronEmissionRate [private] |
Definition at line 54 of file HPDNoiseReader.h.
Referenced by emissionRate(), and HPDNoiseReader().
TFile* HPDNoiseReader::mFile [private] |
Definition at line 49 of file HPDNoiseReader.h.
Referenced by HPDNoiseReader(), and ~HPDNoiseReader().
std::vector<float> HPDNoiseReader::mIonFeedbackFirstPeakRate [private] |
Definition at line 52 of file HPDNoiseReader.h.
Referenced by HPDNoiseReader(), and ionFeedbackFirstPeakRate().
std::vector<float> HPDNoiseReader::mIonFeedbackSecondPeakRate [private] |
Definition at line 53 of file HPDNoiseReader.h.
Referenced by HPDNoiseReader(), and ionFeedbackSecondPeakRate().
std::vector<TTree*> HPDNoiseReader::mTrees [private] |
Definition at line 50 of file HPDNoiseReader.h.
Referenced by allNames(), getHandle(), grabEntry(), HPDNoiseReader(), totalEntries(), and ~HPDNoiseReader().