11 #include "boost/bind.hpp"
20 sharedResources_(sharedResources),
21 statReporter_(sharedResources->statisticsReporter_),
22 streamRecord_(statReporter_->getStreamsMonitorCollection().getNewStreamRecord()),
23 diskWritingParams_(dbFileHandler->getDiskWritingParams()),
24 dbFileHandler_(dbFileHandler)
30 std::string errorMsg =
"Failed to close all files for stream " +
streamLabel() +
": ";
41 XCEPT_DECLARE_NESTED( stor::exception::DiskWriting,
42 sentinelException, errorMsg, e );
49 XCEPT_DECLARE( stor::exception::DiskWriting,
50 sentinelException, errorMsg );
56 errorMsg +=
"Unknown exception";
57 XCEPT_DECLARE( stor::exception::DiskWriting,
58 sentinelException, errorMsg );
80 const uint32_t& lumiSection,
85 std::remove_if(fileHandlers_.begin(),
91 return streamRecord_->reportLumiSectionInfo(lumiSection, str);
98 handler->writeEvent(event);
113 if ( (*it)->lumiSection() ==
event.lumiSection() )
134 statReporter_->getFilesMonitorCollection().getNewFileRecord();
138 fileRecord->runNumber =
event.runNumber();
139 fileRecord->lumiSection =
event.lumiSection();
141 catch(stor::exception::IncompleteEventMessage &
e)
144 fileRecord->lumiSection = 0;
147 fileRecord->baseFilePath =
149 fileRecord->coreFileName =
151 fileRecord->fileCounter =
getFileCounter(fileRecord->coreFileName);
153 fileRecord->isOpen =
true;
167 return diskWritingParams_.filePath_ + getFileSystem(runNumber, fileCount);
173 const uint32_t& runNumber,
179 if (diskWritingParams_.nLogicalDisk_ <= 0) {
return "";}
181 unsigned int fileSystemNumber =
183 + atoi(diskWritingParams_.smInstanceString_.c_str())
185 % diskWritingParams_.nLogicalDisk_;
187 std::ostringstream fileSystem;
188 fileSystem <<
"/" << std::setfill(
'0') << std::setw(2) << fileSystemNumber;
190 return fileSystem.str();
196 const uint32_t& runNumber,
197 const uint32_t& lumiSection
200 std::ostringstream coreFileName;
201 coreFileName << diskWritingParams_.setupLabel_
202 <<
"." << std::setfill(
'0') << std::setw(8) << runNumber
203 <<
"." << std::setfill(
'0') << std::setw(4) << lumiSection
205 <<
"." << diskWritingParams_.fileName_
206 <<
"." << std::setfill(
'0') << std::setw(2) << diskWritingParams_.smInstanceString_;
208 return coreFileName.str();
230 const unsigned long long maxFileSizeMB =
234 return ( maxFileSizeMB * 1024 * 1024 );
CoreFileNamesMap usedCoreFileNames_
std::string getCoreFileName(const uint32_t &runNumber, const uint32_t &lumiSection) const
virtual int getStreamMaxFileSize() const =0
const StatisticsReporterPtr statReporter_
boost::shared_ptr< SharedResources > SharedResourcesPtr
StreamHandler(const SharedResourcesPtr, const DbFileHandlerPtr)
boost::shared_ptr< FileRecord > FileRecordPtr
unsigned long long getMaxFileSize() const
virtual std::string streamLabel() const =0
unsigned int getFileCounter(const std::string &coreFileName)
virtual FileHandlerPtr newFileHandler(const I2OChain &event)=0
boost::shared_ptr< DbFileHandler > DbFileHandlerPtr
std::string getBaseFilePath(const uint32_t &runNumber, uint32_t fileCount) const
boost::posix_time::ptime TimePoint_t
void closeTimedOutFiles(utils::TimePoint_t currentTime=utils::getCurrentTime())
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void writeEvent(const I2OChain &event)
virtual FileHandlerPtr getFileHandler(const I2OChain &event)
FilesMonitorCollection::FileRecordPtr getNewFileRecord(const I2OChain &event)
bool tooOld(const utils::TimePoint_t currentTime=utils::getCurrentTime())
const StreamsMonitorCollection::StreamRecordPtr streamRecord_
unsigned long totalDataSize() const
FileHandlers fileHandlers_
const DiskWritingParams & diskWritingParams_
boost::shared_ptr< FileHandler > FileHandlerPtr
const SharedResourcesPtr sharedResources_
bool closeFilesForLumiSection(const uint32_t &lumiSection, std::string &)
bool isFromLumiSection(const uint32_t lumiSection)
std::string getFileSystem(const uint32_t &runNumber, uint32_t fileCount) const