1 #ifndef IOPool_Streamer_RawEventOutputModuleForBU_h
2 #define IOPool_Streamer_RawEventOutputModuleForBU_h
19 #include "boost/shared_array.hpp"
22 template <
class Consumer>
61 template <
class Consumer>
63 edm::OutputModule(ps),
64 templateConsumer_(new Consumer(ps)),
65 label_(ps.getUntrackedParameter<std::
string>(
"ProductLabel",
"source")),
66 instance_(ps.getUntrackedParameter<std::
string>(
"ProductInstance",
"")),
67 numEventsPerFile_(ps.getUntrackedParameter<unsigned int>(
"numEventsPerFile",100)),
68 frdVersion_(ps.getUntrackedParameter<unsigned int>(
"frdVersion",3)),
78 template <
class Consumer>
81 template <
class Consumer>
85 if(totevents>0 && totevents%numEventsPerFile_==0){
89 templateConsumer_->initialize(destinationDir,filename,ls);
96 event.getByLabel(label_, instance_, fedBuffers);
99 int headerSize = frdVersion_<3 ? (4+1024)*
sizeof(
uint32) : 7*
sizeof(
uint32);
100 int expectedSize = headerSize;
106 expectedSize += singleFED.
size();
109 totsize += expectedSize;
111 boost::shared_array<unsigned char> workBuffer(
new unsigned char[expectedSize + 256]);
113 *bufPtr++ = (
uint32) frdVersion_;
122 fedsize[
idx] = singleFED.
size();
125 memcpy(bufPtr,fedsize,1024 *
sizeof(
uint32));
129 *bufPtr++ = expectedSize-headerSize;
133 uint32 *payloadPtr=bufPtr;
136 if (singleFED.
size() > 0) {
137 memcpy(bufPtr, singleFED.
data(), singleFED.
size());
138 bufPtr += singleFED.
size()/4;
141 if (frdVersion_>=3) {
145 cms::Adler32((
const char*) payloadPtr, expectedSize-7*
sizeof(
uint32), adlera, adlerb);
146 *(payloadPtr-1) = (adlerb << 16) | adlera;
151 writtensize+=
msg.size();
153 if (templateConsumer_->sharedMode())
154 templateConsumer_->doOutputEvent(workBuffer);
156 templateConsumer_->doOutputEvent(
msg);
159 template <
class Consumer>
163 templateConsumer_->start();
166 template <
class Consumer>
169 templateConsumer_->stop();
172 template <
class Consumer>
177 std::cout <<
" writing to destination dir " << destinationDir <<
" name: " << filename << std::endl;
178 templateConsumer_->initialize(destinationDir,filename,ls.
id().
luminosityBlock());
182 ::gettimeofday(&now,0);
188 writtenSizeLast=writtensize;
189 ::gettimeofday(&startOfLastLumi,0);
193 ::gettimeofday(&startOfLastLumi,0);
198 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()
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 *)
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