CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
evf::RecoEventOutputModuleForFU< Consumer > Class Template Reference

#include <RecoEventOutputModuleForFU.h>

Inheritance diagram for evf::RecoEventOutputModuleForFU< Consumer >:
edm::StreamerOutputModuleBase edm::one::OutputModule< one::WatchRuns, one::WatchLuminosityBlocks > edm::one::OutputModuleBase edm::EDConsumerBase

Public Member Functions

 RecoEventOutputModuleForFU (edm::ParameterSet const &ps)
 
 ~RecoEventOutputModuleForFU () override
 
- Public Member Functions inherited from edm::StreamerOutputModuleBase
 StreamerOutputModuleBase (ParameterSet const &ps)
 
 ~StreamerOutputModuleBase () override
 
- Public Member Functions inherited from edm::one::OutputModule< one::WatchRuns, one::WatchLuminosityBlocks >
 OutputModule (edm::ParameterSet const &iPSet)
 
- Public Member Functions inherited from edm::one::OutputModuleBase
BranchIDLists const * branchIDLists ()
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
 ~OutputModuleBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::StreamerOutputModuleBase
static void fillDescription (ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::one::OutputModuleBase
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlockForOutput const &) override
 
void doOutputEvent (EventMsgBuilder const &msg) override
 
void doOutputHeader (InitMsgBuilder const &init_message) override
 
void endLuminosityBlock (edm::LuminosityBlockForOutput const &) override
 
void initRun ()
 
void start () override
 
void stop () override
 

Private Attributes

jsoncollector::IntJ accepted_
 
std::auto_ptr< Consumer > c_
 
struct flock dataRwFlk_
 
struct flock dataRwFulk_
 
jsoncollector::IntJ errorEvents_
 
jsoncollector::IntJ fileAdler32_
 
jsoncollector::StringJ filelist_
 
jsoncollector::IntJ filesize_
 
evf::FastMonitoringServicefms_
 
jsoncollector::IntJ hltErrorEvents_
 
jsoncollector::StringJ inputFiles_
 
boost::shared_ptr< jsoncollector::FastMonitorjsonMonitor_
 
jsoncollector::StringJ mergeType_
 
boost::filesystem::path openDatChecksumFilePath_
 
boost::filesystem::path openDatFilePath_
 
unsigned char * outBuf_ = 0
 
jsoncollector::DataPointDefinition outJsonDef_
 
jsoncollector::IntJ processed_
 
bool readAdler32Check_ =false
 
jsoncollector::IntJ retCodeMask_
 
std::string streamLabel_
 
jsoncollector::StringJ transferDestination_
 

Additional Inherited Members

- Public Types inherited from edm::one::OutputModuleBase
typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<typename Consumer>
class evf::RecoEventOutputModuleForFU< Consumer >

Definition at line 25 of file RecoEventOutputModuleForFU.h.

Constructor & Destructor Documentation

template<typename Consumer >
evf::RecoEventOutputModuleForFU< Consumer >::RecoEventOutputModuleForFU ( edm::ParameterSet const &  ps)
explicit

Consumers are supposed to provide void doOutputHeader(InitMsgBuilder const& init_message) void doOutputEvent(EventMsgBuilder const& msg) void start() void stop() static void fillDescription(ParameterSetDescription&)

Definition at line 78 of file RecoEventOutputModuleForFU.h.

References Exception, evf::RecoEventOutputModuleForFU< Consumer >::fms_, evf::RecoEventOutputModuleForFU< Consumer >::streamLabel_, and AlCaHLTBitMon_QueryRunRegistry::string.

78  :
81  c_(new Consumer(ps)),
82  streamLabel_(ps.getParameter<std::string>("@module_label")),
83  processed_(0),
84  accepted_(0),
85  errorEvents_(0),
86  retCodeMask_(0),
87  filelist_(),
88  filesize_(0),
89  inputFiles_(),
90  fileAdler32_(1),
92  mergeType_(),
93  hltErrorEvents_(0),
94  outBuf_(new unsigned char[1024*1024]),
95  dataRwFlk_( evf::EvFDaqDirector::make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )),
96  dataRwFulk_( evf::EvFDaqDirector::make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() ))
97 
98  {
99  //replace hltOutoputA with stream if the HLT menu uses this convention
100  std::string testPrefix="hltOutput";
101  if (streamLabel_.find(testPrefix)==0)
102  streamLabel_=std::string("stream")+streamLabel_.substr(testPrefix.size());
103 
104  if (streamLabel_.find("_")!=std::string::npos) {
105  throw cms::Exception("RecoEventOutputModuleForFU")
106  << "Underscore character is reserved can not be used for stream names in FFF, but was detected in stream name -: " << streamLabel_;
107  }
108 
109  std::string streamLabelLow = streamLabel_;
110  boost::algorithm::to_lower(streamLabelLow);
111  auto streampos = streamLabelLow.rfind("stream");
112  if (streampos !=0 && streampos!=std::string::npos)
113  throw cms::Exception("RecoEventOutputModuleForFU")
114  << "stream (case-insensitive) sequence was found in stream suffix. This is reserved and can not be used for names in FFF based HLT, but was detected in stream name";
115 
117  }
static struct flock make_flock(short type, short whence, off_t start, off_t len, pid_t pid)
OutputModuleBase(ParameterSet const &pset)
template<typename Consumer >
evf::RecoEventOutputModuleForFU< Consumer >::~RecoEventOutputModuleForFU ( )
override

Definition at line 187 of file RecoEventOutputModuleForFU.h.

187 {}

Member Function Documentation

template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::beginJob ( void  )
overrideprivatevirtual
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::beginLuminosityBlock ( edm::LuminosityBlockForOutput const &  ls)
overrideprivate

Definition at line 283 of file RecoEventOutputModuleForFU.h.

References evf::RecoEventOutputModuleForFU< Consumer >::c_, evf::RecoEventOutputModuleForFU< Consumer >::filelist_, edm::LuminosityBlockForOutput::luminosityBlock(), evf::RecoEventOutputModuleForFU< Consumer >::openDatChecksumFilePath_, evf::RecoEventOutputModuleForFU< Consumer >::openDatFilePath_, and evf::RecoEventOutputModuleForFU< Consumer >::streamLabel_.

284  {
285  //edm::LogInfo("RecoEventOutputModuleForFU") << "begin lumi";
286  openDatFilePath_ = edm::Service<evf::EvFDaqDirector>()->getOpenDatFilePath(ls.luminosityBlock(),streamLabel_);
287  openDatChecksumFilePath_ = edm::Service<evf::EvFDaqDirector>()->getOpenDatFilePath(ls.luminosityBlock(),streamLabel_);
288  c_->setOutputFile(openDatFilePath_.string());
289  filelist_ = openDatFilePath_.filename().string();
290  }
boost::filesystem::path openDatChecksumFilePath_
def ls(path, rec=False)
Definition: eostools.py:348
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::doOutputEvent ( EventMsgBuilder const &  msg)
overrideprivatevirtual

Implements edm::StreamerOutputModuleBase.

Definition at line 248 of file RecoEventOutputModuleForFU.h.

References evf::RecoEventOutputModuleForFU< Consumer >::accepted_, evf::RecoEventOutputModuleForFU< Consumer >::c_, and jsoncollector::IntJ::value().

248  {
249  accepted_.value()++;
250  c_->doOutputEvent(msg); // You can't use msg in RecoEventOutputModuleForFU after this point
251  }
tuple msg
Definition: mps_check.py:277
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::doOutputHeader ( InitMsgBuilder const &  init_message)
overrideprivatevirtual

Implements edm::StreamerOutputModuleBase.

Definition at line 211 of file RecoEventOutputModuleForFU.h.

References cms::Adler32(), evf::RecoEventOutputModuleForFU< Consumer >::c_, Exception, evf::RecoEventOutputModuleForFU< Consumer >::outBuf_, TrackRefitter_38T_cff::src, trackingPlots::stat, evf::RecoEventOutputModuleForFU< Consumer >::streamLabel_, and AlCaHLTBitMon_QueryRunRegistry::string.

212  {
213  c_->doOutputHeader(init_message);
214 
215  const std::string openIniFileName = edm::Service<evf::EvFDaqDirector>()->getOpenInitFilePath(streamLabel_);
216  struct stat istat;
217  stat(openIniFileName.c_str(), &istat);
218  //read back file to check integrity of what was written
219  off_t readInput=0;
220  uint32_t adlera=1,adlerb=0;
221  FILE *src = fopen(openIniFileName.c_str(),"r");
222  while (readInput<istat.st_size)
223  {
224  size_t toRead= readInput+1024*1024 < istat.st_size ? 1024*1024 : istat.st_size-readInput;
225  fread(outBuf_,toRead,1,src);
226  cms::Adler32((const char*)outBuf_,toRead,adlera,adlerb);
227  readInput+=toRead;
228  }
229  fclose(src);
230  //free output buffer if micromerge is not done by the module
231  if (edm::Service<evf::EvFDaqDirector>()->microMergeDisabled()) {
232  delete [] outBuf_;
233  outBuf_=nullptr;
234  }
235  uint32_t adler32c = (adlerb << 16) | adlera;
236  if (adler32c != c_->get_adler32_ini()) {
237  throw cms::Exception("RecoEventOutputModuleForFU") << "Checksum mismatch of ini file -: " << openIniFileName
238  << " expected:" << c_->get_adler32_ini() << " obtained:" << adler32c;
239  }
240  else {
241  edm::LogWarning("RecoEventOutputModuleForFU") << "Ini file checksum -: "<< streamLabel_ << " " << adler32c;
242  boost::filesystem::rename(openIniFileName,edm::Service<evf::EvFDaqDirector>()->getInitFilePath(streamLabel_));
243  }
244  }
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::endLuminosityBlock ( edm::LuminosityBlockForOutput const &  ls)
overrideprivate

Definition at line 293 of file RecoEventOutputModuleForFU.h.

References evf::RecoEventOutputModuleForFU< Consumer >::accepted_, cms::Adler32(), evf::RecoEventOutputModuleForFU< Consumer >::c_, evf::RecoEventOutputModuleForFU< Consumer >::dataRwFlk_, Exception, f, evf::RecoEventOutputModuleForFU< Consumer >::fileAdler32_, evf::RecoEventOutputModuleForFU< Consumer >::filelist_, evf::RecoEventOutputModuleForFU< Consumer >::filesize_, evf::RecoEventOutputModuleForFU< Consumer >::fms_, evf::FastMonitoringService::getEventsProcessedForLumi(), evf::RecoEventOutputModuleForFU< Consumer >::jsonMonitor_, LogDebug, edm::LuminosityBlockForOutput::luminosityBlock(), evf::RecoEventOutputModuleForFU< Consumer >::openDatFilePath_, evf::RecoEventOutputModuleForFU< Consumer >::outBuf_, evf::RecoEventOutputModuleForFU< Consumer >::processed_, evf::RecoEventOutputModuleForFU< Consumer >::readAdler32Check_, TrackRefitter_38T_cff::src, trackingPlots::stat, evf::RecoEventOutputModuleForFU< Consumer >::streamLabel_, AlCaHLTBitMon_QueryRunRegistry::string, and jsoncollector::IntJ::value().

294  {
295  //edm::LogInfo("RecoEventOutputModuleForFU") << "end lumi";
296  long filesize=0;
297  fileAdler32_.value() = c_->get_adler32();
298  c_->closeOutputFile();
299  bool abortFlag = false;
300  processed_.value() = fms_->getEventsProcessedForLumi(ls.luminosityBlock(),&abortFlag);
301 
302  if (abortFlag) {
303  edm::LogInfo("RecoEventOutputModuleForFU") << "output suppressed";
304  return;
305  }
306 
307  if(processed_.value()!=0) {
308 
309  //lock
310  struct stat istat;
311  if (!edm::Service<evf::EvFDaqDirector>()->microMergeDisabled()) {
312 
313  //create if does not exist then lock the merge destination file
314  FILE *des = fopen(edm::Service<evf::EvFDaqDirector>()->getMergedDatFilePath(ls.luminosityBlock(),streamLabel_).c_str(), "a"); //open stream for appending
315  int data_readwrite_fd = fileno(des);
316 
317  //deleter function: unlock and close file
318  auto finishFile = [des, data_readwrite_fd, this](FILE* f) {
319  fflush(f);
320  fcntl(data_readwrite_fd,F_SETLKW, &dataRwFulk_);
321  fclose(des);
322  };
323 
324  std::unique_ptr<FILE,decltype(finishFile)> desGuard{des,finishFile};
325 
326  if (data_readwrite_fd == -1)
327  edm::LogError("RecoEventOutputModuleForFU") << "problem with creating filedesc for datamerge " << strerror(errno);
328  else
329  LogDebug("RecoEventOutputModuleForFU") << "creating filedesc for datamerge -: " << data_readwrite_fd;
330  fcntl(data_readwrite_fd, F_SETLKW, &dataRwFlk_);
331 
332  std::string deschecksum = edm::Service<evf::EvFDaqDirector>()->getMergedDatChecksumFilePath(ls.luminosityBlock(), streamLabel_);
333 
334  struct stat istat;
335  FILE * cf = nullptr;
336  uint32_t mergedAdler32=1;
337  //get adler32 accumulated checksum for the merged file
338  if (!stat(deschecksum.c_str(), &istat)) {
339  if (istat.st_size) {
340  cf = fopen(deschecksum.c_str(),"r");
341  if (!cf) throw cms::Exception("RecoEventOutputModuleForFU") << "Unable to open checksum file -: " << deschecksum.c_str();
342  fscanf(cf,"%u",&mergedAdler32);
343  fclose(cf);
344  }
345  else edm::LogWarning("RecoEventOutputModuleForFU") << "Checksum file size is empty -: "<< deschecksum.c_str();
346  }
347 
348  FILE *src = fopen(openDatFilePath_.string().c_str(),"r");
349 
350  stat(openDatFilePath_.string().c_str(), &istat);
351  off_t readInput=0;
352  uint32_t adlera=1;
353  uint32_t adlerb=0;
354  while (readInput<istat.st_size) {
355  size_t toRead= readInput+1024*1024 < istat.st_size ? 1024*1024 : istat.st_size-readInput;
356  fread(outBuf_,toRead,1,src);
357  fwrite(outBuf_,toRead,1,des);
358  if (readAdler32Check_)
359  cms::Adler32((const char*)outBuf_,toRead,adlera,adlerb);
360  readInput+=toRead;
361  filesize+=toRead;
362  }
363 
364  //write new string representation of the checksum value
365  cf = fopen(deschecksum.c_str(),"w");
366  if (!cf) throw cms::Exception("RecoEventOutputModuleForFU") << "Unable to open or rewind checksum file for writing -:" << deschecksum.c_str();
367 
368  //write adler32 combine to checksum file
369  mergedAdler32 = adler32_combine(mergedAdler32,fileAdler32_.value(),filesize);
370 
371  fprintf(cf,"%u",mergedAdler32);
372  fclose(cf);
373 
374  fclose(src);
375 
376  if (readAdler32Check_ && ((adlerb << 16) | adlera) != fileAdler32_.value()) {
377 
378  throw cms::Exception("RecoEventOutputModuleForFU") << "Adler32 checksum mismatch after reading file -: "
379  << openDatFilePath_.string() <<" in LS " << ls.luminosityBlock() << std::endl;
380  }
381  }
382  else { //no micromerge by HLT
383  stat(openDatFilePath_.string().c_str(), &istat);
384  filesize = istat.st_size;
385  boost::filesystem::rename(openDatFilePath_.string().c_str(), edm::Service<evf::EvFDaqDirector>()->getDatFilePath(ls.luminosityBlock(),streamLabel_));
386  }
387  } else {
388  //return if not in empty lumisection mode
389  if (!edm::Service<evf::EvFDaqDirector>()->emptyLumisectionMode()) {
390  remove(openDatFilePath_.string().c_str());
391  return;
392  }
393  filelist_ = "";
394  fileAdler32_.value()=-1;
395  }
396 
397  //remove file
398  remove(openDatFilePath_.string().c_str());
399  filesize_=filesize;
400 
401  jsonMonitor_->snap(ls.luminosityBlock());
402  const std::string outputJsonNameStream =
403  edm::Service<evf::EvFDaqDirector>()->getOutputJsonFilePath(ls.luminosityBlock(),streamLabel_);
404  jsonMonitor_->outputFullJSON(outputJsonNameStream,ls.luminosityBlock());
405 
406  // reset monitoring params
407  accepted_.value() = 0;
408  filelist_ = "";
409  }
#define LogDebug(id)
unsigned int getEventsProcessedForLumi(unsigned int lumi, bool *abortFlag=0)
boost::shared_ptr< jsoncollector::FastMonitor > jsonMonitor_
double f[11][100]
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
def ls(path, rec=False)
Definition: eostools.py:348
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 255 of file RecoEventOutputModuleForFU.h.

References edm::ConfigurationDescriptions::addDefault(), and edm::StreamerOutputModuleBase::fillDescription().

255  {
258  Consumer::fillDescription(desc);
259  // Use addDefault here instead of add for 4 reasons:
260  // 1. Because EvFOutputModule_cfi.py is explicitly defined it does not need to be autogenerated
261  // The explicitly defined version overrides the autogenerated version of the cfi file.
262  // 2. That cfi file is not used anywhere in the release anyway
263  // 3. There are two plugin names used for the same template instantiation of this
264  // type, "ShmStreamConsumer" and "EvFOutputModule" and this causes name conflict
265  // problems for the cfi generation code which are avoided with addDefault.
266  // 4. At the present time, there is only one type of Consumer used to instantiate
267  // instances of this template, but if there were more than one type then this function
268  // would need to be specialized for each type unless the descriptions were the same
269  // and addDefault was used.
270  descriptions.addDefault(desc);
271  }
static void fillDescription(ParameterSetDescription &desc)
void addDefault(ParameterSetDescription const &psetDescription)
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::initRun ( void  )
private

Definition at line 120 of file RecoEventOutputModuleForFU.h.

References evf::RecoEventOutputModuleForFU< Consumer >::accepted_, jsoncollector::DataPointDefinition::addLegendItem(), jsoncollector::DataPointDefinition::ADLER32, jsoncollector::DataPointDefinition::BINARYOR, jsoncollector::DataPointDefinition::CAT, ws_sso_content_reader::content, evf::RecoEventOutputModuleForFU< Consumer >::errorEvents_, evf::RecoEventOutputModuleForFU< Consumer >::fileAdler32_, evf::RecoEventOutputModuleForFU< Consumer >::filelist_, evf::RecoEventOutputModuleForFU< Consumer >::filesize_, evf::RecoEventOutputModuleForFU< Consumer >::hltErrorEvents_, evf::RecoEventOutputModuleForFU< Consumer >::inputFiles_, evf::RecoEventOutputModuleForFU< Consumer >::jsonMonitor_, LogDebug, jsoncollector::DataPointDefinition::MERGE, evf::RecoEventOutputModuleForFU< Consumer >::mergeType_, evf::RecoEventOutputModuleForFU< Consumer >::outJsonDef_, evf::RecoEventOutputModuleForFU< Consumer >::processed_, evf::RecoEventOutputModuleForFU< Consumer >::readAdler32Check_, evf::RecoEventOutputModuleForFU< Consumer >::retCodeMask_, jsoncollector::DataPointDefinition::SAME, jsoncollector::JSONSerializer::serialize(), jsoncollector::DataPointDefinition::setDefaultGroup(), jsoncollector::JsonMonitorable::setName(), AlCaHLTBitMon_QueryRunRegistry::string, jsoncollector::DataPointDefinition::SUM, evf::RecoEventOutputModuleForFU< Consumer >::transferDestination_, and jsoncollector::FileIO::writeStringToFile().

Referenced by evf::RecoEventOutputModuleForFU< Consumer >::start().

121  {
122  std::string baseRunDir = edm::Service<evf::EvFDaqDirector>()->baseRunDir();
123  readAdler32Check_ = edm::Service<evf::EvFDaqDirector>()->outputAdler32Recheck();
124  LogDebug("RecoEventOutputModuleForFU") << "writing .dat files to -: " << baseRunDir;
125  // create open dir if not already there
126  edm::Service<evf::EvFDaqDirector>()->createRunOpendirMaybe();
127 
128  processed_.setName("Processed");
129  accepted_.setName("Accepted");
130  errorEvents_.setName("ErrorEvents");
131  retCodeMask_.setName("ReturnCodeMask");
132  filelist_.setName("Filelist");
133  filesize_.setName("Filesize");
134  inputFiles_.setName("InputFiles");
135  fileAdler32_.setName("FileAdler32");
136  transferDestination_.setName("TransferDestination");
137  mergeType_.setName("MergeType");
138  hltErrorEvents_.setName("HLTErrorEvents");
139 
152  std::stringstream tmpss,ss;
153  tmpss << baseRunDir << "/open/" << "output_" << getpid() << ".jsd";
154  ss << baseRunDir << "/" << "output_" << getpid() << ".jsd";
155  std::string outTmpJsonDefName = tmpss.str();
156  std::string outJsonDefName = ss.str();
157 
158  edm::Service<evf::EvFDaqDirector>()->lockInitLock();
159  struct stat fstat;
160  if (stat (outJsonDefName.c_str(), &fstat) != 0) { //file does not exist
161  LogDebug("RecoEventOutputModuleForFU") << "writing output definition file -: " << outJsonDefName;
164  jsoncollector::FileIO::writeStringToFile(outTmpJsonDefName, content);
165  boost::filesystem::rename(outTmpJsonDefName,outJsonDefName);
166  }
167  edm::Service<evf::EvFDaqDirector>()->unlockInitLock();
168 
170  jsonMonitor_->setDefPath(outJsonDefName);
171  jsonMonitor_->registerGlobalMonitorable(&processed_,false);
172  jsonMonitor_->registerGlobalMonitorable(&accepted_,false);
173  jsonMonitor_->registerGlobalMonitorable(&errorEvents_,false);
174  jsonMonitor_->registerGlobalMonitorable(&retCodeMask_,false);
175  jsonMonitor_->registerGlobalMonitorable(&filelist_,false);
176  jsonMonitor_->registerGlobalMonitorable(&filesize_,false);
177  jsonMonitor_->registerGlobalMonitorable(&inputFiles_,false);
178  jsonMonitor_->registerGlobalMonitorable(&fileAdler32_,false);
179  jsonMonitor_->registerGlobalMonitorable(&transferDestination_,false);
180  jsonMonitor_->registerGlobalMonitorable(&mergeType_,false);
181  jsonMonitor_->registerGlobalMonitorable(&hltErrorEvents_,false);
182  jsonMonitor_->commit(nullptr);
183 
184  }
#define LogDebug(id)
void addLegendItem(std::string const &name, std::string const &type, std::string const &operation)
boost::shared_ptr< jsoncollector::FastMonitor > jsonMonitor_
static bool serialize(JsonSerializable *pObj, std::string &output)
virtual void setName(std::string name)
static void writeStringToFile(std::string const &filename, std::string &content)
Definition: FileIO.cc:21
jsoncollector::DataPointDefinition outJsonDef_
void setDefaultGroup(std::string const &group)
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::start ( void  )
overrideprivatevirtual

Implements edm::StreamerOutputModuleBase.

Definition at line 191 of file RecoEventOutputModuleForFU.h.

References evf::RecoEventOutputModuleForFU< Consumer >::c_, evf::RecoEventOutputModuleForFU< Consumer >::initRun(), evf::RecoEventOutputModuleForFU< Consumer >::streamLabel_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by progressbar.ProgressBar::__next__(), Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

192  {
193  initRun();
194  const std::string openInitFileName = edm::Service<evf::EvFDaqDirector>()->getOpenInitFilePath(streamLabel_);
195  edm::LogInfo("RecoEventOutputModuleForFU") << "start() method, initializing streams. init stream -: "
196  << openInitFileName;
197  c_->setInitMessageFile(openInitFileName);
198  c_->start();
199 
200  }
template<typename Consumer >
void evf::RecoEventOutputModuleForFU< Consumer >::stop ( )
overrideprivatevirtual

Implements edm::StreamerOutputModuleBase.

Definition at line 204 of file RecoEventOutputModuleForFU.h.

References evf::RecoEventOutputModuleForFU< Consumer >::c_.

205  {
206  c_->stop();
207  }

Member Data Documentation

template<typename Consumer >
jsoncollector::IntJ evf::RecoEventOutputModuleForFU< Consumer >::accepted_
mutableprivate
template<typename Consumer >
std::auto_ptr<Consumer> evf::RecoEventOutputModuleForFU< Consumer >::c_
private
template<typename Consumer >
struct flock evf::RecoEventOutputModuleForFU< Consumer >::dataRwFlk_
private
template<typename Consumer >
struct flock evf::RecoEventOutputModuleForFU< Consumer >::dataRwFulk_
private

Definition at line 73 of file RecoEventOutputModuleForFU.h.

template<typename Consumer >
jsoncollector::IntJ evf::RecoEventOutputModuleForFU< Consumer >::errorEvents_
private
template<typename Consumer >
jsoncollector::IntJ evf::RecoEventOutputModuleForFU< Consumer >::fileAdler32_
private
template<typename Consumer >
jsoncollector::StringJ evf::RecoEventOutputModuleForFU< Consumer >::filelist_
private
template<typename Consumer >
jsoncollector::IntJ evf::RecoEventOutputModuleForFU< Consumer >::filesize_
private
template<typename Consumer >
evf::FastMonitoringService* evf::RecoEventOutputModuleForFU< Consumer >::fms_
private
template<typename Consumer >
jsoncollector::IntJ evf::RecoEventOutputModuleForFU< Consumer >::hltErrorEvents_
private
template<typename Consumer >
jsoncollector::StringJ evf::RecoEventOutputModuleForFU< Consumer >::inputFiles_
private
template<typename Consumer >
boost::shared_ptr<jsoncollector::FastMonitor> evf::RecoEventOutputModuleForFU< Consumer >::jsonMonitor_
private
template<typename Consumer >
jsoncollector::StringJ evf::RecoEventOutputModuleForFU< Consumer >::mergeType_
private
template<typename Consumer >
boost::filesystem::path evf::RecoEventOutputModuleForFU< Consumer >::openDatChecksumFilePath_
private
template<typename Consumer >
boost::filesystem::path evf::RecoEventOutputModuleForFU< Consumer >::openDatFilePath_
private
template<typename Consumer >
unsigned char* evf::RecoEventOutputModuleForFU< Consumer >::outBuf_ = 0
private
template<typename Consumer >
jsoncollector::DataPointDefinition evf::RecoEventOutputModuleForFU< Consumer >::outJsonDef_
private
template<typename Consumer >
jsoncollector::IntJ evf::RecoEventOutputModuleForFU< Consumer >::processed_
private
template<typename Consumer >
bool evf::RecoEventOutputModuleForFU< Consumer >::readAdler32Check_ =false
private
template<typename Consumer >
jsoncollector::IntJ evf::RecoEventOutputModuleForFU< Consumer >::retCodeMask_
private
template<typename Consumer >
std::string evf::RecoEventOutputModuleForFU< Consumer >::streamLabel_
private
template<typename Consumer >
jsoncollector::StringJ evf::RecoEventOutputModuleForFU< Consumer >::transferDestination_
private