1 #ifndef IOPool_Streamer_RawEventOutputModuleForBU_h
2 #define IOPool_Streamer_RawEventOutputModuleForBU_h
20 #include "boost/shared_array.hpp"
23 template <
class Consumer>
62 template <
class Consumer>
64 edm::OutputModule(ps),
65 templateConsumer_(new Consumer(ps)),
66 label_(ps.getUntrackedParameter<std::
string>(
"ProductLabel",
"source")),
67 instance_(ps.getUntrackedParameter<std::
string>(
"ProductInstance",
"")),
68 numEventsPerFile_(ps.getUntrackedParameter<unsigned int>(
"numEventsPerFile",100)),
69 frdVersion_(ps.getUntrackedParameter<unsigned int>(
"frdVersion",3)),
79 template <
class Consumer>
82 template <
class Consumer>
86 if(totevents>0 && totevents%numEventsPerFile_==0){
90 templateConsumer_->initialize(destinationDir,filename,ls);
97 event.getByLabel(label_, instance_, fedBuffers);
101 int expectedSize = headerSize;
107 expectedSize += singleFED.
size();
110 totsize += expectedSize;
112 boost::shared_array<unsigned char> workBuffer(
new unsigned char[expectedSize + 256]);
114 *bufPtr++ = (
uint32) frdVersion_;
125 fedsize[
idx] = singleFED.
size();
128 memcpy(bufPtr,fedsize,1024 *
sizeof(
uint32));
132 *bufPtr++ = expectedSize-headerSize;
137 uint32 *payloadPtr=bufPtr;
140 if (singleFED.
size() > 0) {
141 memcpy(bufPtr, singleFED.
data(), singleFED.
size());
142 bufPtr += singleFED.
size()/4;
148 *(payloadPtr-1) =
crc32c(crc,(
const unsigned char*) payloadPtr, expectedSize-headerSize);
150 else if (frdVersion_>=3) {
154 cms::Adler32((
const char*) payloadPtr, expectedSize-headerSize, adlera, adlerb);
155 *(payloadPtr-1) = (adlerb << 16) | adlera;
160 writtensize+=
msg.size();
162 if (templateConsumer_->sharedMode())
163 templateConsumer_->doOutputEvent(workBuffer);
165 templateConsumer_->doOutputEvent(
msg);
168 template <
class Consumer>
172 templateConsumer_->start();
175 template <
class Consumer>
178 templateConsumer_->stop();
181 template <
class Consumer>
186 std::cout <<
" writing to destination dir " << destinationDir <<
" name: " << filename << std::endl;
187 templateConsumer_->initialize(destinationDir,filename,ls.
id().
luminosityBlock());
191 ::gettimeofday(&now,0);
197 writtenSizeLast=writtensize;
198 ::gettimeofday(&startOfLastLumi,0);
202 ::gettimeofday(&startOfLastLumi,0);
207 template <
class Consumer>
EventNumber_t event() const
virtual void beginRun(edm::RunPrincipal const &, edm::ModuleCallingContext const *)
virtual void write(edm::EventPrincipal const &e, edm::ModuleCallingContext const *)
~RawEventOutputModuleForBU()
const uint32 FRDHeaderVersionSize[6]
unsigned long long writtensize
edm::LuminosityBlockNumber_t luminosityBlock() const
LuminosityBlockNumber_t luminosityBlock() const
RawEventOutputModuleForBU(edm::ParameterSet const &ps)
size_t size() const
Lenght of the data buffer in bytes.
unsigned long long totsize
virtual void writeLuminosityBlock(const edm::LuminosityBlockPrincipal &, edm::ModuleCallingContext const *)
unsigned long long writtenSizeLast
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
virtual void beginLuminosityBlock(edm::LuminosityBlockPrincipal const &, edm::ModuleCallingContext const *)
virtual void endLuminosityBlock(edm::LuminosityBlockPrincipal const &, edm::ModuleCallingContext const *)
uint32_t crc32c(uint32_t crc, const unsigned char *buf, size_t len)
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
LuminosityBlockNumber_t luminosityBlock() const
virtual void endRun(edm::RunPrincipal const &, edm::ModuleCallingContext const *)
unsigned int numEventsPerFile_
virtual void writeRun(const edm::RunPrincipal &, edm::ModuleCallingContext const *)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
std::auto_ptr< Consumer > templateConsumer_
LuminosityBlockID id() const