CMS 3D CMS Logo

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

#include <HPDNoiseMaker.h>

Public Member Functions

int addHpd (const std::string &fName)
 define new HPD instance More...
 
 HPDNoiseMaker (const std::string &fFileName)
 
void newHpdEvent (const std::string &mName, const HPDNoiseData &mData)
 add new HPD noise event by HPD name More...
 
void newHpdEvent (size_t i, const HPDNoiseData &mData)
 add new HPD noise event by HPD index More...
 
void setRate (const std::string &fName, float fDischargeRate, float fIonFeedbackFirstPeakRate, float fIonFeedbackSecondPeakRate, float fElectronEmissionRate)
 set noise rate for the instance by using different processes More...
 
unsigned long totalEntries (const std::string &mName) const
 get number of stored events by HPD index More...
 
 ~HPDNoiseMaker ()
 

Private Member Functions

 HPDNoiseMaker (const HPDNoiseMaker &)
 
HPDNoiseMakeroperator= (const HPDNoiseMaker &)
 

Private Attributes

HPDNoiseDataCatalogmCatalog
 
TFile * mFile
 
std::vector< std::string > mNames
 
std::vector< TTree * > mTrees
 

Detailed Description

Definition at line 18 of file HPDNoiseMaker.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file HPDNoiseMaker.cc.

References mCatalog, and mFile.

19  {
20  mFile = new TFile (fFileName.c_str(), "RECREATE");
22 }
HPDNoiseDataCatalog * mCatalog
Definition: HPDNoiseMaker.h:41
HPDNoiseMaker::~HPDNoiseMaker ( )

Definition at line 24 of file HPDNoiseMaker.cc.

References i, mCatalog, mFile, mTrees, and HPDNoiseDataCatalog::objectName().

24  {
25  for (size_t i = 0; i < mTrees.size(); ++i) {
26  mTrees[i]->Write();
27  delete mTrees[i];
28  }
30  delete mCatalog;
31  delete mFile;
32 }
int i
Definition: DBlmapReader.cc:9
HPDNoiseDataCatalog * mCatalog
Definition: HPDNoiseMaker.h:41
std::vector< TTree * > mTrees
Definition: HPDNoiseMaker.h:39
static const char * objectName()
object name
HPDNoiseMaker::HPDNoiseMaker ( const HPDNoiseMaker )
private

Member Function Documentation

int HPDNoiseMaker::addHpd ( const std::string &  fName)

define new HPD instance

Definition at line 34 of file HPDNoiseMaker.cc.

References HPDNoiseDataCatalog::addHpd(), HPDNoiseData::branchName(), ecal_dqm_sourceclient-live_cfg::cerr, HPDNoiseData::className(), mCatalog, mFile, mNames, and mTrees.

34  {
35  TDirectory* currentDirectory = gDirectory;
36  mFile->cd();
37  mCatalog->addHpd (fName, 0., 0.,0.,0.);
38  mNames.push_back (fName);
39  mTrees.push_back (new TTree (fName.c_str(), fName.c_str()));
40  HPDNoiseData* addr = 0;
41  TBranch* newBranch = mTrees.back()->Branch (HPDNoiseData::branchName(), HPDNoiseData::className(), &addr, 32000, 1);
42  if (!newBranch) {
43  std::cerr << "HPDNoiseMaker::addHpd-> Can not make branch HPDNoiseData to the tree " << fName << std::endl;
44  }
45  currentDirectory->cd();
46  return mNames.size();
47 }
HPDNoiseDataCatalog * mCatalog
Definition: HPDNoiseMaker.h:41
std::vector< std::string > mNames
Definition: HPDNoiseMaker.h:40
std::vector< TTree * > mTrees
Definition: HPDNoiseMaker.h:39
static const char * className()
class name
Definition: HPDNoiseData.h:34
static const char * branchName()
branch name
Definition: HPDNoiseData.h:36
void addHpd(const std::string &fName, float fDischargeRate, float fIonFeedbackFirstPeakRate, float fIonFeedbackSecondPeakRate, float fElectronEmissionRate)
add new HPD instance to the catalog
void HPDNoiseMaker::newHpdEvent ( const std::string &  mName,
const HPDNoiseData mData 
)

add new HPD noise event by HPD name

Definition at line 54 of file HPDNoiseMaker.cc.

References i, and mNames.

54  {
55  for (size_t i = 0; i < mNames.size(); ++i) {
56  if (mNames[i] == fName) {
57  newHpdEvent (i, fData);
58  }
59  }
60 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > mNames
Definition: HPDNoiseMaker.h:40
void newHpdEvent(const std::string &mName, const HPDNoiseData &mData)
add new HPD noise event by HPD name
void HPDNoiseMaker::newHpdEvent ( size_t  i,
const HPDNoiseData mData 
)

add new HPD noise event by HPD index

Definition at line 62 of file HPDNoiseMaker.cc.

References HPDNoiseData::branchName(), ecal_dqm_sourceclient-live_cfg::cerr, data, i, and mTrees.

62  {
63  if (i < mTrees.size()) {
64  HPDNoiseData* data = (HPDNoiseData*) &fData;
65  TBranch* branch = mTrees[i]->GetBranch (HPDNoiseData::branchName());
66  if (branch) {
67  branch->SetAddress(&data);
68  mTrees[i]->Fill();
69  }
70  else {
71  std::cerr << "HPDNoiseMaker::newHpdEvent-> Can not find branch " << HPDNoiseData::branchName()
72  << " in the tree" << std::endl;
73  }
74  }
75 }
int i
Definition: DBlmapReader.cc:9
std::vector< TTree * > mTrees
Definition: HPDNoiseMaker.h:39
static const char * branchName()
branch name
Definition: HPDNoiseData.h:36
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
HPDNoiseMaker& HPDNoiseMaker::operator= ( const HPDNoiseMaker )
private
void HPDNoiseMaker::setRate ( const std::string &  fName,
float  fDischargeRate,
float  fIonFeedbackFirstPeakRate,
float  fIonFeedbackSecondPeakRate,
float  fElectronEmissionRate 
)

set noise rate for the instance by using different processes

Definition at line 49 of file HPDNoiseMaker.cc.

References mCatalog, and HPDNoiseDataCatalog::setRate().

50  {
51  mCatalog->setRate (fName, fDischargeRate, fIonFeedbackFirstPeakRate, fIonFeedbackSecondPeakRate, fElectronEmissionRate);
52 }
HPDNoiseDataCatalog * mCatalog
Definition: HPDNoiseMaker.h:41
void setRate(const std::string &fName, float fDischargeRate, float fIonFeedbackFirstPeakRate, float fIonFeedbackSecondPeakRate, float fElectronEmissionRate)
set discharge/IonFeedback/Electron emission noise rates
unsigned long HPDNoiseMaker::totalEntries ( const std::string &  mName) const

get number of stored events by HPD index

Definition at line 77 of file HPDNoiseMaker.cc.

References i, mNames, and mTrees.

77  {
78  for (size_t i = 0; i < mNames.size(); ++i) {
79  if (mNames[i] == fName) return mTrees[i]->GetEntries ();
80  }
81  return 0;
82 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > mNames
Definition: HPDNoiseMaker.h:40
std::vector< TTree * > mTrees
Definition: HPDNoiseMaker.h:39

Member Data Documentation

HPDNoiseDataCatalog* HPDNoiseMaker::mCatalog
private

Definition at line 41 of file HPDNoiseMaker.h.

Referenced by addHpd(), HPDNoiseMaker(), setRate(), and ~HPDNoiseMaker().

TFile* HPDNoiseMaker::mFile
private

Definition at line 38 of file HPDNoiseMaker.h.

Referenced by addHpd(), HPDNoiseMaker(), and ~HPDNoiseMaker().

std::vector<std::string> HPDNoiseMaker::mNames
private

Definition at line 40 of file HPDNoiseMaker.h.

Referenced by addHpd(), newHpdEvent(), and totalEntries().

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

Definition at line 39 of file HPDNoiseMaker.h.

Referenced by addHpd(), newHpdEvent(), totalEntries(), and ~HPDNoiseMaker().