1 #ifndef IOPool_Streamer_RawEventOutputModuleForBU_h
2 #define IOPool_Streamer_RawEventOutputModuleForBU_h
18 #include "boost/shared_array.hpp"
21 template <
class Consumer>
60 template <
class Consumer>
62 edm::OutputModule(ps),
63 templateConsumer_(new Consumer(ps)),
64 label_(ps.getUntrackedParameter<std::
string>(
"ProductLabel",
"source")),
65 instance_(ps.getUntrackedParameter<std::
string>(
"ProductInstance",
"")),
66 numEventsPerFile_(ps.getUntrackedParameter<unsigned int>(
"numEventsPerFile",100)),
67 frdVersion_(ps.getUntrackedParameter<unsigned int>(
"frdVersion",3)),
77 template <
class Consumer>
80 template <
class Consumer>
84 if(totevents>0 && totevents%numEventsPerFile_==0){
88 templateConsumer_->initialize(destinationDir,filename,ls);
95 event.getByLabel(label_, instance_, fedBuffers);
98 int headerSize = frdVersion_<3 ? (4+1024)*
sizeof(
uint32) : 7*
sizeof(
uint32);
99 int expectedSize = headerSize;
103 expectedSize += singleFED.
size();
106 totsize += expectedSize;
108 boost::shared_array<unsigned char> workBuffer(
new unsigned char[expectedSize + 256]);
110 *bufPtr++ = (
uint32) frdVersion_;
119 fedsize[
idx] = singleFED.
size();
122 memcpy(bufPtr,fedsize,1024 *
sizeof(
uint32));
126 *bufPtr++ = expectedSize-headerSize;
130 uint32 *payloadPtr=bufPtr;
133 if (singleFED.
size() > 0) {
134 memcpy(bufPtr, singleFED.
data(), singleFED.
size());
135 bufPtr += singleFED.
size()/4;
138 if (frdVersion_>=3) {
142 cms::Adler32((
const char*) payloadPtr, expectedSize-7*
sizeof(
uint32), adlera, adlerb);
143 *(payloadPtr-1) = (adlerb << 16) | adlera;
148 writtensize+=
msg.size();
150 if (templateConsumer_->sharedMode())
151 templateConsumer_->doOutputEvent(workBuffer);
153 templateConsumer_->doOutputEvent(
msg);
156 template <
class Consumer>
160 templateConsumer_->start();
163 template <
class Consumer>
166 templateConsumer_->stop();
169 template <
class Consumer>
174 std::cout <<
" writing to destination dir " << destinationDir <<
" name: " << filename << std::endl;
175 templateConsumer_->initialize(destinationDir,filename,ls.
id().
luminosityBlock());
179 ::gettimeofday(&now,0);
185 writtenSizeLast=writtensize;
186 ::gettimeofday(&startOfLastLumi,0);
190 ::gettimeofday(&startOfLastLumi,0);
195 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