CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventFileHandler.cc
Go to the documentation of this file.
1 // $Id: EventFileHandler.cc,v 1.19 2012/04/04 12:17:00 mommsen Exp $
3 
8 
9 #include <iostream>
10 
11 
12 namespace stor {
13 
15  (
16  InitMsgSharedPtr view,
18  const DbFileHandlerPtr dbFileHandler,
19  const uint64_t& maxFileSize
20  ) :
21  FileHandler(fileRecord, dbFileHandler, maxFileSize),
22  writer_(new edm::StreamerFileWriter(fileRecord->completeFileName()))
23  {
24  writeHeader(view);
25  }
26 
27 
29  {
30  InitMsgView initView(&(*view)[0]);
31  writer_->doOutputHeader(initView);
32  fileRecord_->fileSize += view->size();
34  }
35 
36 
38  {
40 
41  event.hltTriggerBits(evtParams.hltBits);
42  evtParams.headerPtr = (char*) event.headerLocation();
43  evtParams.headerSize = event.headerSize();
44 
45  unsigned int fragCount = event.fragmentCount();
46  evtParams.fragmentCount = fragCount;
47 
48  for (unsigned int idx = 0; idx < fragCount; ++idx)
49  {
50  evtParams.fragmentIndex = idx;
51  evtParams.dataPtr = (char*) event.dataLocation(idx);
52  evtParams.dataSize = event.dataSize(idx);
53 
54  writer_->doOutputEventFragment(evtParams);
55  }
56  }
57 
58 
60  {
61  if ( ! fileRecord_->isOpen ) return;
62 
63  if (writer_)
64  {
65  // if writer was reset, we already closed the stream but failed to move the file to the closed position
66  writer_->stop();
67  fileRecord_->fileSize += writer_->getStreamEOFSize();
68  fileRecord_->adler32 = writer_->get_adler32();
69  writer_.reset(); // Destruct the writer to flush the file stream
70  }
71  moveFileToClosed(reason);
73  }
74 
75 } // namespace stor
76 
77 
TimePoint_t getCurrentTime()
Definition: Utils.h:158
void moveFileToClosed(const FilesMonitorCollection::FileRecord::ClosingReason &)
Definition: FileHandler.cc:190
std::vector< unsigned char > hltBits
virtual void closeFile(const FilesMonitorCollection::FileRecord::ClosingReason &)
string reason
Definition: Association.py:177
EventFileHandler(InitMsgSharedPtr, FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
boost::shared_ptr< InitMsgBuffer > InitMsgSharedPtr
virtual void do_writeEvent(const I2OChain &)
boost::shared_ptr< FileRecord > FileRecordPtr
boost::shared_ptr< DbFileHandler > DbFileHandlerPtr
Definition: DbFileHandler.h:71
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
utils::TimePoint_t lastEntry_
Definition: FileHandler.h:185
void updateDatabase() const
Definition: FileHandler.cc:70
unsigned char * headerLocation() const
Definition: I2OChain.cc:462
void writeHeader(InitMsgSharedPtr)
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
unsigned long long uint64_t
Definition: Time.h:15
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
FilesMonitorCollection::FileRecordPtr fileRecord_
Definition: FileHandler.h:181
boost::scoped_ptr< edm::StreamerFileWriter > writer_
unsigned char * dataLocation(int fragmentIndex) const
Definition: I2OChain.cc:444