CMS 3D CMS Logo

edm::FRDStreamService Class Reference

#include <EventFilter/StorageManager/interface/FRDStreamService.h>

Inheritance diagram for edm::FRDStreamService:

edm::StreamService

List of all members.

Public Member Functions

void closeTimedOutFiles ()
void closeTimedOutFiles (int lumi, double timeoutstart)
 FRDStreamService (ParameterSet const &)
bool nextEvent (const uint8 *const)
void report (std::ostream &os, int indentation) const
void stop ()
 ~FRDStreamService ()

Private Member Functions

bool checkEvent (boost::shared_ptr< FileRecord >, FRDEventMsgView const &) const
boost::shared_ptr< FileRecordgenerateFileRecord ()
boost::shared_ptr< OutputServicegetOutputService (FRDEventMsgView const &)
boost::shared_ptr< OutputServicenewOutputService ()


Detailed Description

Definition at line 23 of file FRDStreamService.h.


Constructor & Destructor Documentation

FRDStreamService::FRDStreamService ( ParameterSet const &  pset  ) 

Definition at line 22 of file FRDStreamService.cc.

References edm::StreamService::highWaterMark_, edm::StreamService::lumiSection_, edm::StreamService::lumiSectionTimeOut_, edm::StreamService::maxFileSizeInMB_, edm::StreamService::maxSize_, edm::StreamService::ntotal_, edm::StreamService::numberOfFileSystems_, edm::StreamService::parameterSet_, edm::StreamService::runNumber_, and edm::StreamService::setStreamParameter().

00023 {
00024   parameterSet_ = pset;
00025   runNumber_ = 0;
00026   lumiSection_ = 0;
00027   numberOfFileSystems_ = 0;
00028   maxFileSizeInMB_ = 0;
00029   maxSize_ = 0;
00030   highWaterMark_ = 0;
00031   lumiSectionTimeOut_ = 0;
00032   ntotal_ = 0;
00033 
00034   setStreamParameter();
00035 }

edm::FRDStreamService::~FRDStreamService (  )  [inline]

Definition at line 27 of file FRDStreamService.h.

References stop().

00027 { stop(); }


Member Function Documentation

bool edm::FRDStreamService::checkEvent ( boost::shared_ptr< FileRecord ,
FRDEventMsgView const &   
) const [private]

Referenced by getOutputService().

void FRDStreamService::closeTimedOutFiles (  )  [virtual]

Implements edm::StreamService.

Definition at line 95 of file FRDStreamService.cc.

00096 {
00097   // since we are currently storing all events in a single file,
00098   // we never close files at lumi section boundaries
00099 
00100   return;
00101 }

void FRDStreamService::closeTimedOutFiles ( int  lumi,
double  timeoutstart 
) [virtual]

Implements edm::StreamService.

Definition at line 83 of file FRDStreamService.cc.

00084 {
00085   // since we are currently storing all events in a single file,
00086   // we never close files at lumi section boundaries
00087 
00088   return;
00089 }

boost::shared_ptr< FileRecord > FRDStreamService::generateFileRecord (  )  [private]

Definition at line 166 of file FRDStreamService.cc.

References fd, aod_PYTHIA_cfg::fileName, edm::StreamService::fileName_, edm::StreamService::filePath_, it, edm::StreamService::list_lock_, edm::StreamService::lumiSection_, edm::StreamService::ntotal_, edm::StreamService::numberOfFileSystems_, edm::StreamService::outputSummary_, edm::StreamService::runNumber_, edm::StreamService::setupLabel_, sl, edm::StreamService::sourceId_, and edm::StreamService::streamLabel_.

Referenced by newOutputService().

00167 {
00168   std::ostringstream oss;   
00169   oss    << setupLabel_ 
00170          << "." << setfill('0') << std::setw(8) << runNumber_ 
00171          << "." << setfill('0') << std::setw(4) << lumiSection_
00172          << "." << streamLabel_ 
00173          << "." << fileName_
00174          << "." << setfill('0') << std::setw(2) << sourceId_;
00175   string fileName = oss.str();
00176 
00177   shared_ptr<FileRecord> fd = shared_ptr<FileRecord>(new FileRecord(lumiSection_, fileName, filePath_));    
00178   ++ntotal_;
00179 
00180   boost::mutex::scoped_lock sl(list_lock_);
00181   map<string, int>::iterator it = outputSummary_.find(fileName);
00182   if(it==outputSummary_.end()) {
00183      outputSummary_.insert(std::pair<string, int>(fileName,0));
00184   } else {
00185      ++it->second;
00186      fd->setFileCounter(it->second);
00187   }
00188 
00189   if (numberOfFileSystems_ > 0)
00190     fd->fileSystem((runNumber_ + atoi(sourceId_.c_str()) + ntotal_) % numberOfFileSystems_); 
00191   
00192   fd->checkDirectories();
00193   fd->setRunNumber(runNumber_);
00194   fd->setStreamLabel(streamLabel_);
00195   fd->setSetupLabel(setupLabel_);
00196 
00197   // fd->report(cout, 12);
00198   return fd;
00199 }

boost::shared_ptr< OutputService > FRDStreamService::getOutputService ( FRDEventMsgView const &  view  )  [private]

Definition at line 107 of file FRDStreamService.cc.

References checkEvent(), fd, edm::StreamService::fillOutputSummaryClosed(), it, edm::StreamService::lumiSection_, and edm::StreamService::outputMap_.

Referenced by nextEvent().

00108 {
00109   for (OutputMapIterator it = outputMap_.begin(); it != outputMap_.end(); ++it) {
00110        if (it->first->lumiSection() == lumiSection_) {
00111           if (checkEvent(it->first, view))
00112             return it->second;
00113           else {
00114             boost::shared_ptr<FileRecord> fd(it->first);
00115             outputMap_.erase(it);
00116             fillOutputSummaryClosed(fd);
00117             break;
00118           }
00119       }
00120   }
00121   return newOutputService();
00122 }

boost::shared_ptr< OutputService > FRDStreamService::newOutputService (  )  [private]

Definition at line 131 of file FRDStreamService.cc.

References file, generateFileRecord(), and edm::StreamService::outputMap_.

00132 {
00133   boost::shared_ptr<FileRecord> file = generateFileRecord();
00134 
00135   shared_ptr<OutputService> outputService(new FRDOutputService(file));
00136   outputMap_[file] = outputService;
00137 
00138   return outputService;
00139 }

bool FRDStreamService::nextEvent ( const uint8 * const  bufPtr  )  [virtual]

Implements edm::StreamService.

Definition at line 41 of file FRDStreamService.cc.

References getOutputService(), edm::StreamService::lumiSection_, FRDEventMsgView::run(), and edm::StreamService::runNumber_.

00042 {
00043   ProgressMarker::instance()->processing(true);
00044   FRDEventMsgView view((void *) bufPtr);
00045 
00046   // accept all Error events, so no call to any sort of acceptEvents() method...
00047 
00048   runNumber_   = view.run();
00049   lumiSection_ = 1;  // Error message doesn't yet have lumi section number
00050                      // *and* we want to keep all Error events in the same
00051                      // file, for now
00052 
00053 
00054   shared_ptr<OutputService> outputService = getOutputService(view);
00055   ProgressMarker::instance()->processing(false);
00056   
00057   ProgressMarker::instance()->writing(true);
00058   outputService->writeEvent(bufPtr);
00059   ProgressMarker::instance()->writing(false);
00060   return true;
00061 }

void edm::FRDStreamService::report ( std::ostream &  os,
int  indentation 
) const [virtual]

Implements edm::StreamService.

void FRDStreamService::stop (  )  [virtual]

Implements edm::StreamService.

Definition at line 67 of file FRDStreamService.cc.

References fd, edm::StreamService::fillOutputSummaryClosed(), it, and edm::StreamService::outputMap_.

Referenced by ~FRDStreamService().

00068 {
00069   for (OutputMapIterator it = outputMap_.begin(); it != outputMap_.end(); ) {
00070     boost::shared_ptr<FileRecord> fd(it->first);
00071     outputMap_.erase(it++);
00072     fillOutputSummaryClosed(fd);
00073   }
00074 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:41:02 2009 for CMSSW by  doxygen 1.5.4