CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HPDNoiseReader Class Reference

#include <HPDNoiseReader.h>

Public Types

typedef int Handle
 

Public Member Functions

std::vector< std::string > allNames () const
 all HPD instances in the library More...
 
float dischargeRate (Handle fHandle) const
 discharge rate for the instance More...
 
float emissionRate (Handle fHandle) const
 ithermal/field emission rate for the instance More...
 
void getEntry (Handle fHandle, HPDNoiseData **fData)
 retrive one entry from the sequentially More...
 
void getEntry (Handle fHandle, unsigned long fEntry, HPDNoiseData **fData)
 retrive one entry from the library directly More...
 
Handle getHandle (const std::string &fName)
 get handle to access data for one HPD instance More...
 
 HPDNoiseReader (const std::string &fFileName)
 
float ionFeedbackFirstPeakRate (Handle fHandle) const
 ionfeedback rate for the instance More...
 
float ionFeedbackSecondPeakRate (Handle fHandle) const
 
unsigned long totalEntries (Handle fHandle) const
 total number of noise events for the HPD instance in the library More...
 
bool valid (Handle fHandle) const
 test if handle is valid More...
 
 ~HPDNoiseReader ()
 

Private Member Functions

void grabEntry (Handle fHandle, unsigned long fEntry)
 
 HPDNoiseReader (const HPDNoiseReader &)
 
HPDNoiseReaderoperator= (const HPDNoiseReader &)
 

Private Attributes

HPDNoiseDatamBuffer
 
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
 

Detailed Description

Definition at line 17 of file HPDNoiseReader.h.

Member Typedef Documentation

Definition at line 19 of file HPDNoiseReader.h.

Constructor & Destructor Documentation

HPDNoiseReader::HPDNoiseReader ( const std::string &  fFileName)

Definition at line 18 of file HPDNoiseReader.cc.

References HPDNoiseDataCatalog::allNames(), validate_alignment_devdb10_cfg::catalog, ecal_dqm_sourceclient-live_cfg::cerr, HPDNoiseDataCatalog::getDischargeRate(), HPDNoiseDataCatalog::getElectronEmissionRate(), HPDNoiseDataCatalog::getIonFeedbackFirstPeakRate(), HPDNoiseDataCatalog::getIonFeedbackSecondPeakRate(), i, mBuffer, mCurrentEntry, mDischargeRate, mElectronEmissionRate, mFile, mIonFeedbackFirstPeakRate, mIonFeedbackSecondPeakRate, mTrees, cscdqm::h::names, HPDNoiseDataCatalog::objectName(), and MainPageGenerator::tree.

18  {
19  mFile = new TFile (fFileName.c_str(), "READ");
20  mBuffer = new HPDNoiseData ();
22  mFile->GetObject (HPDNoiseDataCatalog::objectName(), catalog);
23  if (catalog) {
24  // initiate trees
25  const std::vector<std::string> names = catalog->allNames();
26  for (size_t i = 0; i < names.size(); ++i) {
27  TTree* tree = (TTree*) mFile->Get (names[i].c_str());
28  if (tree) {
29  mTrees.push_back (tree);
30  mDischargeRate.push_back (catalog->getDischargeRate (i));
33  mElectronEmissionRate.push_back(catalog->getElectronEmissionRate(i));
34  mCurrentEntry.push_back (0);
35  }
36  else {
37  std::cerr << "HPDNoiseReader::HPDNoiseReader-> Can not open tree " << names[i] << " in file " << fFileName << std::endl;
38  }
39  }
40  }
41  else {
42  std::cerr << "HPDNoiseReader::HPDNoiseReader-> Can not open catalog infile " << fFileName << std::endl;
43  }
44 }
int i
Definition: DBlmapReader.cc:9
static const HistoName names[]
float getElectronEmissionRate(size_t i) const
get thermal electron emission noise rate for the HPD instance
std::vector< float > mElectronEmissionRate
static const char * objectName()
object name
std::vector< float > mIonFeedbackSecondPeakRate
float getIonFeedbackSecondPeakRate(size_t i) const
float getIonFeedbackFirstPeakRate(size_t i) const
get ion feedback noise rate for the HPD instance
HPDNoiseData * mBuffer
const std::vector< std::string > & allNames() const
all HPD instance names
std::vector< float > mIonFeedbackFirstPeakRate
float getDischargeRate(size_t i) const
get noise rate for the HPD instance
std::vector< TTree * > mTrees
std::vector< size_t > mCurrentEntry
std::vector< float > mDischargeRate
HPDNoiseReader::~HPDNoiseReader ( )

Definition at line 46 of file HPDNoiseReader.cc.

References i, mBuffer, mFile, and mTrees.

46  {
47  for (size_t i = 0; i < mTrees.size(); ++i) {
48  delete mTrees[i];
49  }
50  delete mFile;
51  delete mBuffer;
52 }
int i
Definition: DBlmapReader.cc:9
HPDNoiseData * mBuffer
std::vector< TTree * > mTrees
HPDNoiseReader::HPDNoiseReader ( const HPDNoiseReader )
private

Member Function Documentation

std::vector< std::string > HPDNoiseReader::allNames ( ) const

all HPD instances in the library

Definition at line 55 of file HPDNoiseReader.cc.

References i, mTrees, and mps_fire::result.

Referenced by HPDNoiseLibraryReader::HPDNoiseLibraryReader().

55  {
56  std::vector<std::string> result;
57  for (size_t i = 0; i < mTrees.size(); ++i) result.push_back (mTrees[i]->GetName ());
58  return result;
59 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: mps_fire.py:83
std::vector< TTree * > mTrees
float HPDNoiseReader::dischargeRate ( Handle  fHandle) const

discharge rate for the instance

Definition at line 68 of file HPDNoiseReader.cc.

References mDischargeRate, and valid().

Referenced by HPDNoiseLibraryReader::fillRates().

68  {
69  if (!valid (fHandle)) return 0;
70  return mDischargeRate[fHandle];
71 }
bool valid(Handle fHandle) const
test if handle is valid
std::vector< float > mDischargeRate
float HPDNoiseReader::emissionRate ( Handle  fHandle) const

ithermal/field emission rate for the instance

Definition at line 80 of file HPDNoiseReader.cc.

References mElectronEmissionRate, and valid().

80  {
81  if (!valid (fHandle)) return 0;
82  return mElectronEmissionRate[fHandle];
83 }
std::vector< float > mElectronEmissionRate
bool valid(Handle fHandle) const
test if handle is valid
void HPDNoiseReader::getEntry ( Handle  fHandle,
HPDNoiseData **  fData 
)

retrive one entry from the sequentially

Definition at line 98 of file HPDNoiseReader.cc.

References mps_splice::entry, grabEntry(), mBuffer, mCurrentEntry, totalEntries(), and valid().

Referenced by HPDNoiseLibraryReader::getNoiseData().

98  {
99  if (!valid (fHandle)) return;
100  unsigned int entry = mCurrentEntry [fHandle];
101  if (++entry >= totalEntries (fHandle)) entry = 0; // roll over
102  grabEntry (fHandle, entry);
103  *fData = mBuffer;
104 }
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
HPDNoiseData * mBuffer
list entry
Definition: mps_splice.py:62
std::vector< size_t > mCurrentEntry
void grabEntry(Handle fHandle, unsigned long fEntry)
void HPDNoiseReader::getEntry ( Handle  fHandle,
unsigned long  fEntry,
HPDNoiseData **  fData 
)

retrive one entry from the library directly

Definition at line 106 of file HPDNoiseReader.cc.

References grabEntry(), and mBuffer.

106  {
107  grabEntry (fHandle, fEntry);
108  *fData = mBuffer;
109 }
HPDNoiseData * mBuffer
std::pair< double, double > fEntry
Definition: CrossSection.h:40
void grabEntry(Handle fHandle, unsigned long fEntry)
HPDNoiseReader::Handle HPDNoiseReader::getHandle ( const std::string &  fName)

get handle to access data for one HPD instance

Definition at line 61 of file HPDNoiseReader.cc.

References MainPageGenerator::fName, i, mTrees, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HPDNoiseLibraryReader::fillRates(), and HPDNoiseLibraryReader::getNoiseData().

61  {
62  for (size_t i = 0; i < mTrees.size(); ++i) {
63  if (std::string (mTrees[i]->GetName ()) == fName) return i;
64  }
65  return -1;
66 }
int i
Definition: DBlmapReader.cc:9
std::vector< TTree * > mTrees
void HPDNoiseReader::grabEntry ( Handle  fHandle,
unsigned long  fEntry 
)
private

Definition at line 90 of file HPDNoiseReader.cc.

References HPDNoiseData::branchName(), mBuffer, mCurrentEntry, mTrees, and valid().

Referenced by getEntry().

90  {
91  if (!valid (fHandle)) return;
92  TBranch* branch = mTrees[fHandle]->GetBranch (HPDNoiseData::branchName());
93  branch->SetAddress (&mBuffer);
94  branch->GetEntry (fEntry);
95  mCurrentEntry [fHandle] = fEntry;
96 }
bool valid(Handle fHandle) const
test if handle is valid
HPDNoiseData * mBuffer
static const char * branchName()
branch name
Definition: HPDNoiseData.h:36
std::pair< double, double > fEntry
Definition: CrossSection.h:40
std::vector< TTree * > mTrees
std::vector< size_t > mCurrentEntry
float HPDNoiseReader::ionFeedbackFirstPeakRate ( Handle  fHandle) const

ionfeedback rate for the instance

Definition at line 72 of file HPDNoiseReader.cc.

References mIonFeedbackFirstPeakRate, and valid().

Referenced by HPDNoiseLibraryReader::fillRates().

72  {
73  if (!valid (fHandle)) return 0;
74  return mIonFeedbackFirstPeakRate[fHandle];
75 }
bool valid(Handle fHandle) const
test if handle is valid
std::vector< float > mIonFeedbackFirstPeakRate
float HPDNoiseReader::ionFeedbackSecondPeakRate ( Handle  fHandle) const

Definition at line 76 of file HPDNoiseReader.cc.

References mIonFeedbackSecondPeakRate, and valid().

Referenced by HPDNoiseLibraryReader::fillRates().

76  {
77  if (!valid (fHandle)) return 0;
78  return mIonFeedbackSecondPeakRate[fHandle];
79 }
bool valid(Handle fHandle) const
test if handle is valid
std::vector< float > mIonFeedbackSecondPeakRate
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 85 of file HPDNoiseReader.cc.

References mTrees, and valid().

Referenced by getEntry(), and HPDNoiseLibraryReader::getNoiseData().

85  {
86  if (!valid (fHandle)) return 0;
87  return mTrees[fHandle]->GetEntries ();
88 }
bool valid(Handle fHandle) const
test if handle is valid
std::vector< TTree * > mTrees
bool HPDNoiseReader::valid ( Handle  fHandle) const
inline

Member Data Documentation

HPDNoiseData* HPDNoiseReader::mBuffer
private

Definition at line 55 of file HPDNoiseReader.h.

Referenced by getEntry(), grabEntry(), HPDNoiseReader(), and ~HPDNoiseReader().

std::vector<size_t> HPDNoiseReader::mCurrentEntry
private

Definition at line 54 of file HPDNoiseReader.h.

Referenced by getEntry(), grabEntry(), and HPDNoiseReader().

std::vector<float> HPDNoiseReader::mDischargeRate
private

Definition at line 50 of file HPDNoiseReader.h.

Referenced by dischargeRate(), and HPDNoiseReader().

std::vector<float> HPDNoiseReader::mElectronEmissionRate
private

Definition at line 53 of file HPDNoiseReader.h.

Referenced by emissionRate(), and HPDNoiseReader().

TFile* HPDNoiseReader::mFile
private

Definition at line 48 of file HPDNoiseReader.h.

Referenced by HPDNoiseReader(), and ~HPDNoiseReader().

std::vector<float> HPDNoiseReader::mIonFeedbackFirstPeakRate
private

Definition at line 51 of file HPDNoiseReader.h.

Referenced by HPDNoiseReader(), and ionFeedbackFirstPeakRate().

std::vector<float> HPDNoiseReader::mIonFeedbackSecondPeakRate
private

Definition at line 52 of file HPDNoiseReader.h.

Referenced by HPDNoiseReader(), and ionFeedbackSecondPeakRate().

std::vector<TTree*> HPDNoiseReader::mTrees
private