CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HPDNoiseMaker Class Reference

#include <HPDNoiseMaker.h>

List of all members.

Public Member Functions

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

                                                        {
  mFile = new TFile (fFileName.c_str(), "RECREATE");
  mCatalog = new HPDNoiseDataCatalog ();
}
HPDNoiseMaker::~HPDNoiseMaker ( )

Definition at line 25 of file HPDNoiseMaker.cc.

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

                               {
  for (size_t i = 0; i < mTrees.size(); ++i) {
    mTrees[i]->Write();
    delete mTrees[i];
  }
  mFile->WriteObject (mCatalog, HPDNoiseDataCatalog::objectName ());
  delete mCatalog;
  delete mFile;
}
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.

                                                 {
  TDirectory* currentDirectory = gDirectory;
  mFile->cd();
  mCatalog->addHpd (fName, 0., 0.,0.,0.);
  mNames.push_back (fName);
  mTrees.push_back (new TTree (fName.c_str(), fName.c_str()));
  HPDNoiseData* addr = 0;
  TBranch* newBranch = mTrees.back()->Branch (HPDNoiseData::branchName(), HPDNoiseData::className(), &addr, 32000, 1);
  if (!newBranch) {
    std::cerr << "HPDNoiseMaker::addHpd-> Can not make branch HPDNoiseData to the tree " << fName << std::endl;
  }
  currentDirectory->cd();
  return mNames.size();
}
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, AlCaHLTBitMon_QueryRunRegistry::data, i, and mTrees.

                                                                    {
  if (i < mTrees.size()) {
    HPDNoiseData* data = (HPDNoiseData*) &fData;
    TBranch* branch = mTrees[i]->GetBranch (HPDNoiseData::branchName());
    if (branch) {
      branch->SetAddress(&data);
      mTrees[i]->Fill();
    }
    else {
      std::cerr << "HPDNoiseMaker::newHpdEvent-> Can not find branch " << HPDNoiseData::branchName() 
                << " in the tree" << std::endl;
    }
  }
}
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.

                                                                                  {
  for (size_t i = 0; i < mNames.size(); ++i) {
    if (mNames[i] == fName) {
      newHpdEvent (i, fData);
    }
  }
}
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().

                                                                                                                             {
  mCatalog->setRate (fName, fDischargeRate, fIonFeedbackFirstPeakRate, fIonFeedbackSecondPeakRate, fElectronEmissionRate);
}
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.

                                                                       {
  for (size_t i = 0; i < mNames.size(); ++i) {
    if (mNames[i] == fName) return mTrees[i]->GetEntries ();
  }
  return 0;
}

Member Data Documentation

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().