CMS 3D CMS Logo

Public Member Functions | Private Attributes

CastorDbProducer Class Reference

#include <CalibFormats/CastorDbProducer/interface/CastorDbProducer.h>

Inheritance diagram for CastorDbProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 CastorDbProducer (const edm::ParameterSet &)
void channelQualityCallback (const CastorChannelQualityRcd &fRecord)
void electronicsMapCallback (const CastorElectronicsMapRcd &fRecord)
void gainsCallback (const CastorGainsRcd &fRecord)
void gainWidthsCallback (const CastorGainWidthsRcd &fRecord)
void pedestalsCallback (const CastorPedestalsRcd &fRecord)
void pedestalWidthsCallback (const CastorPedestalWidthsRcd &fRecord)
boost::shared_ptr
< CastorDbService
produce (const CastorDbRecord &)
void QIEDataCallback (const CastorQIEDataRcd &fRecord)
 ~CastorDbProducer ()

Private Attributes

std::vector< std::string > mDumpRequest
std::ostream * mDumpStream
boost::shared_ptr
< CastorDbService
mService

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 20 of file CastorDbProducer.h.


Constructor & Destructor Documentation

CastorDbProducer::CastorDbProducer ( const edm::ParameterSet fConfig)

Definition at line 37 of file CastorDbProducer.cc.

References channelQualityCallback(), gather_cfg::cout, edm::eventsetup::dependsOn(), electronicsMapCallback(), gainsCallback(), gainWidthsCallback(), edm::ParameterSet::getUntrackedParameter(), mDumpRequest, mDumpStream, pedestalsCallback(), pedestalWidthsCallback(), QIEDataCallback(), and edm::ESProducer::setWhatProduced().

  : ESProducer(),
    mService (new CastorDbService (fConfig)),
    mDumpRequest (),
    mDumpStream(0)
{
  //the following line is needed to tell the framework what
  // data is being produced
  setWhatProduced (this, (dependsOn (&CastorDbProducer::pedestalsCallback,
                                     &CastorDbProducer::gainsCallback) &
                          &CastorDbProducer::pedestalWidthsCallback &
                          &CastorDbProducer::QIEDataCallback &
                          &CastorDbProducer::gainWidthsCallback &
                          &CastorDbProducer::channelQualityCallback &
                          &CastorDbProducer::electronicsMapCallback
                          )
                   );
  
  //now do what ever other initialization is needed

  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
  if (!mDumpRequest.empty()) {
    std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
    mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
  }
}
CastorDbProducer::~CastorDbProducer ( )

Definition at line 65 of file CastorDbProducer.cc.

References gather_cfg::cout, and mDumpStream.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)
  if (mDumpStream != &std::cout) delete mDumpStream;
}

Member Function Documentation

void CastorDbProducer::channelQualityCallback ( const CastorChannelQualityRcd fRecord)

Definition at line 138 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecord::get(), mDumpRequest, mDumpStream, mService, and edm::ESHandle< T >::product().

Referenced by CastorDbProducer().

                                                                                     {
  edm::ESHandle <CastorChannelQuality> item;
  fRecord.get (item);
  mService->setData (item.product ());
  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
    *mDumpStream << "New HCAL/CASTOR ChannelQuality set" << std::endl;
    CastorDbASCIIIO::dumpObject (*mDumpStream, *(item.product ()));
  }
}
void CastorDbProducer::electronicsMapCallback ( const CastorElectronicsMapRcd fRecord)

Definition at line 148 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecord::get(), mDumpRequest, mDumpStream, mService, and edm::ESHandle< T >::product().

Referenced by CastorDbProducer().

                                                                                     {
  edm::ESHandle <CastorElectronicsMap> item;
  fRecord.get (item);
  mService->setData (item.product ());
  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
    *mDumpStream << "New HCAL/CASTOR Electronics Map set" << std::endl;
    CastorDbASCIIIO::dumpObject (*mDumpStream, *(item.product ()));
  }
}
void CastorDbProducer::gainsCallback ( const CastorGainsRcd fRecord)

Definition at line 107 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecord::get(), mDumpRequest, mDumpStream, mService, and edm::ESHandle< T >::product().

Referenced by CastorDbProducer().

                                                                   {
  edm::ESHandle <CastorGains> item;
  fRecord.get (item);
  mService->setData (item.product ());
  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
    *mDumpStream << "New HCAL/CASTOR Gains set" << std::endl;
    CastorDbASCIIIO::dumpObject (*mDumpStream, *(item.product ()));
  }
}
void CastorDbProducer::gainWidthsCallback ( const CastorGainWidthsRcd fRecord)

Definition at line 118 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecord::get(), mDumpRequest, mDumpStream, mService, and edm::ESHandle< T >::product().

Referenced by CastorDbProducer().

                                                                             {
  edm::ESHandle <CastorGainWidths> item;
  fRecord.get (item);
  mService->setData (item.product ());
  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
    *mDumpStream << "New HCAL/CASTOR GainWidths set" << std::endl;
    CastorDbASCIIIO::dumpObject (*mDumpStream, *(item.product ()));
  }
}
void CastorDbProducer::pedestalsCallback ( const CastorPedestalsRcd fRecord)

Definition at line 84 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecord::get(), mDumpRequest, mDumpStream, mService, and edm::ESHandle< T >::product().

Referenced by CastorDbProducer().

                                                                           {

  edm::ESHandle <CastorPedestals> item;
  fRecord.get (item);

  mService->setData (item.product ());
  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
    *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
    CastorDbASCIIIO::dumpObject (*mDumpStream, *(item.product ()));
  }
}
void CastorDbProducer::pedestalWidthsCallback ( const CastorPedestalWidthsRcd fRecord)

Definition at line 96 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecord::get(), mDumpRequest, mDumpStream, mService, and edm::ESHandle< T >::product().

Referenced by CastorDbProducer().

                                                                                     {
  edm::ESHandle <CastorPedestalWidths> item;
  fRecord.get (item);
  mService->setData (item.product ());
  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
    *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
    CastorDbASCIIIO::dumpObject (*mDumpStream, *(item.product ()));
  }
}
boost::shared_ptr< CastorDbService > CastorDbProducer::produce ( const CastorDbRecord )

Definition at line 79 of file CastorDbProducer.cc.

References mService.

{
  return mService;
}
void CastorDbProducer::QIEDataCallback ( const CastorQIEDataRcd fRecord)

Definition at line 128 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecord::get(), mDumpRequest, mDumpStream, mService, and edm::ESHandle< T >::product().

Referenced by CastorDbProducer().

                                                                       {
  edm::ESHandle <CastorQIEData> item;
  fRecord.get (item);
  mService->setData (item.product ());
  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
    *mDumpStream << "New HCAL/CASTOR QIEData set" << std::endl;
    CastorDbASCIIIO::dumpObject (*mDumpStream, *(item.product ()));
  }
}

Member Data Documentation

std::vector<std::string> CastorDbProducer::mDumpRequest [private]
std::ostream* CastorDbProducer::mDumpStream [private]
boost::shared_ptr<CastorDbService> CastorDbProducer::mService [private]