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 19 of file HPDNoiseMaker.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file HPDNoiseMaker.cc.

References mCatalog, and mFile.

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

Definition at line 25 of file HPDNoiseMaker.cc.

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

25  {
26  for (size_t i = 0; i < mTrees.size(); ++i) {
27  mTrees[i]->Write();
28  delete mTrees[i];
29  }
31  delete mCatalog;
32  delete mFile;
33 }
int i
Definition: DBlmapReader.cc:9
HPDNoiseDataCatalog * mCatalog
Definition: HPDNoiseMaker.h:42
std::vector< TTree * > mTrees
Definition: HPDNoiseMaker.h:40
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 35 of file HPDNoiseMaker.cc.

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

35  {
36  TDirectory* currentDirectory = gDirectory;
37  mFile->cd();
38  mCatalog->addHpd (fName, 0., 0.,0.,0.);
39  mNames.push_back (fName);
40  mTrees.push_back (new TTree (fName.c_str(), fName.c_str()));
41  HPDNoiseData* addr = 0;
42  TBranch* newBranch = mTrees.back()->Branch (HPDNoiseData::branchName(), HPDNoiseData::className(), &addr, 32000, 1);
43  if (!newBranch) {
44  std::cerr << "HPDNoiseMaker::addHpd-> Can not make branch HPDNoiseData to the tree " << fName << std::endl;
45  }
46  currentDirectory->cd();
47  return mNames.size();
48 }
HPDNoiseDataCatalog * mCatalog
Definition: HPDNoiseMaker.h:42
std::vector< std::string > mNames
Definition: HPDNoiseMaker.h:41
std::vector< TTree * > mTrees
Definition: HPDNoiseMaker.h:40
static const char * className()
class name
Definition: HPDNoiseData.h:35
static const char * branchName()
branch name
Definition: HPDNoiseData.h:37
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 55 of file HPDNoiseMaker.cc.

References i, and mNames.

55  {
56  for (size_t i = 0; i < mNames.size(); ++i) {
57  if (mNames[i] == fName) {
58  newHpdEvent (i, fData);
59  }
60  }
61 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > mNames
Definition: HPDNoiseMaker.h:41
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 63 of file HPDNoiseMaker.cc.

References HPDNoiseData::branchName(), dtNoiseDBValidation_cfg::cerr, data, i, and mTrees.

63  {
64  if (i < mTrees.size()) {
65  HPDNoiseData* data = (HPDNoiseData*) &fData;
66  TBranch* branch = mTrees[i]->GetBranch (HPDNoiseData::branchName());
67  if (branch) {
68  branch->SetAddress(&data);
69  mTrees[i]->Fill();
70  }
71  else {
72  std::cerr << "HPDNoiseMaker::newHpdEvent-> Can not find branch " << HPDNoiseData::branchName()
73  << " in the tree" << std::endl;
74  }
75  }
76 }
int i
Definition: DBlmapReader.cc:9
std::vector< TTree * > mTrees
Definition: HPDNoiseMaker.h:40
static const char * branchName()
branch name
Definition: HPDNoiseData.h:37
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 50 of file HPDNoiseMaker.cc.

References mCatalog, and HPDNoiseDataCatalog::setRate().

51  {
52  mCatalog->setRate (fName, fDischargeRate, fIonFeedbackFirstPeakRate, fIonFeedbackSecondPeakRate, fElectronEmissionRate);
53 }
HPDNoiseDataCatalog * mCatalog
Definition: HPDNoiseMaker.h:42
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 78 of file HPDNoiseMaker.cc.

References i, mNames, and mTrees.

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

Member Data Documentation

HPDNoiseDataCatalog* HPDNoiseMaker::mCatalog
private

Definition at line 42 of file HPDNoiseMaker.h.

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

TFile* HPDNoiseMaker::mFile
private

Definition at line 39 of file HPDNoiseMaker.h.

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

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

Definition at line 41 of file HPDNoiseMaker.h.

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

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

Definition at line 40 of file HPDNoiseMaker.h.

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