CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
dqmservices::DQMProtobufReader Class Reference

#include <DQMProtobufReader.h>

Inheritance diagram for dqmservices::DQMProtobufReader:
edm::PuttableSourceBase edm::InputSource edm::ProducerBase edm::ProductRegistryHelper

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::InputSource
enum  ItemType {
  IsInvalid, IsStop, IsFile, IsRun,
  IsLumi, IsEvent, IsRepeat, IsSynchronize
}
 
enum  ProcessingMode { Runs, RunsAndLumis, RunsLumisAndEvents }
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 

Public Member Functions

 DQMProtobufReader (edm::ParameterSet const &, edm::InputSourceDescription const &)
 
 ~DQMProtobufReader () override
 
- Public Member Functions inherited from edm::PuttableSourceBase
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
PuttableSourceBaseoperator= (const PuttableSourceBase &)=delete
 
 PuttableSourceBase (ParameterSet const &, InputSourceDescription const &)
 
 PuttableSourceBase (const PuttableSourceBase &)=delete
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
void registerProducts () final
 Register any produced products. More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
- Public Member Functions inherited from edm::InputSource
std::shared_ptr< ActivityRegistryactReg () const
 Accessor for Activity Registry. More...
 
std::shared_ptr< BranchIDListHelper const > branchIDListHelper () const
 Accessors for branchIDListHelper. More...
 
std::shared_ptr< BranchIDListHelper > & branchIDListHelper ()
 
void closeFile (FileBlock *, bool cleaningUpAfterException)
 close current file More...
 
void doBeginJob ()
 Called by framework at beginning of job. More...
 
void doEndJob ()
 Called by framework at end of job. More...
 
void fillProcessBlockHelper ()
 Fill the ProcessBlockHelper with info for the current file. More...
 
ProcessingController::ForwardState forwardState () const
 
bool goToEvent (EventID const &eventID)
 
 InputSource (ParameterSet const &, InputSourceDescription const &)
 Constructor. More...
 
 InputSource (InputSource const &)=delete
 
void issueReports (EventID const &eventID, StreamID streamID)
 issue an event report More...
 
LuminosityBlockNumber_t luminosityBlock () const
 Accessor for current luminosity block number. More...
 
std::shared_ptr< LuminosityBlockAuxiliaryluminosityBlockAuxiliary () const
 Called by the framework to merge or insert lumi in principal cache. More...
 
int maxEvents () const
 
int maxLuminosityBlocks () const
 
ModuleDescription const & moduleDescription () const
 Accessor for 'module' description. More...
 
ItemType nextItemType ()
 Advances the source to the next item. More...
 
bool nextProcessBlock (ProcessBlockPrincipal &)
 Next process block, return false if there is none, sets the processName in the principal. More...
 
InputSourceoperator= (InputSource const &)=delete
 
std::shared_ptr< ProcessBlockHelper const > processBlockHelper () const
 Accessors for processBlockHelper. More...
 
std::shared_ptr< ProcessBlockHelper > & processBlockHelper ()
 
ProcessConfiguration const & processConfiguration () const
 Accessor for Process Configuration. More...
 
std::string const & processGUID () const
 Accessor for global process identifier. More...
 
ProcessHistoryRegistry const & processHistoryRegistry () const
 Accessors for process history registry. More...
 
ProcessHistoryRegistryprocessHistoryRegistry ()
 
ProcessingMode processingMode () const
 RunsLumisAndEvents (default), RunsAndLumis, or Runs. More...
 
std::shared_ptr< ProductRegistry const > productRegistry () const
 Accessors for product registry. More...
 
std::shared_ptr< ProductRegistry > & productRegistry ()
 
bool randomAccess () const
 
void readAndMergeLumi (LuminosityBlockPrincipal &lbp)
 Read next luminosity block (same as a prior lumi) More...
 
void readAndMergeRun (RunPrincipal &rp)
 Read next run (same as a prior run) More...
 
void readEvent (EventPrincipal &ep, StreamContext &)
 Read next event. More...
 
bool readEvent (EventPrincipal &ep, EventID const &, StreamContext &)
 Read a specific event. More...
 
std::shared_ptr< FileBlockreadFile ()
 Read next file. More...
 
void readLuminosityBlock (LuminosityBlockPrincipal &lumiPrincipal, HistoryAppender &historyAppender)
 Read next luminosity block (new lumi) More...
 
std::shared_ptr< LuminosityBlockAuxiliaryreadLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary. More...
 
void readProcessBlock (ProcessBlockPrincipal &)
 Read next process block. More...
 
void readRun (RunPrincipal &runPrincipal, HistoryAppender &historyAppender)
 Read next run (new run) More...
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary ()
 Read next run Auxiliary. More...
 
ProcessHistoryID const & reducedProcessHistoryID () const
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void repeat ()
 Reset the remaining number of events/lumis to the maximum number. More...
 
std::pair< SharedResourcesAcquirer *, std::recursive_mutex * > resourceSharedWithDelayedReader ()
 Returns nullptr if no resource shared between the Source and a DelayedReader. More...
 
ProcessingController::ReverseState reverseState () const
 
void rewind ()
 Begin again at the first event. More...
 
RunNumber_t run () const
 Accessor for current run number. More...
 
std::shared_ptr< RunAuxiliaryrunAuxiliary () const
 Called by the framework to merge or insert run in principal cache. More...
 
void setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb)
 Set the luminosity block ID. More...
 
void setRunNumber (RunNumber_t r)
 Set the run number. More...
 
void skipEvents (int offset)
 
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper () const
 Accessors for thinnedAssociationsHelper. More...
 
std::shared_ptr< ThinnedAssociationsHelper > & thinnedAssociationsHelper ()
 
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source. More...
 
virtual ~InputSource () noexcept(false)
 Destructor. More...
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 

Static Public Member Functions

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

Private Member Functions

void beginLuminosityBlock (edm::LuminosityBlock &lb) override
 
edm::InputSource::ItemType getNextItemType () override
 
void load (DQMStore *store, std::string filename)
 
void logFileAction (char const *msg, char const *fileName) const
 
bool prepareNextFile ()
 
void readEvent_ (edm::EventPrincipal &) override
 
void readLuminosityBlock_ (edm::LuminosityBlockPrincipal &lbCache) override
 
std::shared_ptr< edm::LuminosityBlockAuxiliaryreadLuminosityBlockAuxiliary_ () override
 
void readRun_ (edm::RunPrincipal &rpCache) override
 
std::shared_ptr< edm::RunAuxiliaryreadRunAuxiliary_ () override
 

Private Attributes

DQMFileIterator::LumiEntry currentLumi_
 
DQMFileIterator fiterator_
 
bool flagDeleteDatFiles_
 
bool flagEndOfRunKills_
 
bool flagLoadFiles_
 
bool flagSkipFirstLumis_
 
InputSource::ItemType nextItemType
 
std::unique_ptr< double > streamReader_
 

Additional Inherited Members

- Public Attributes inherited from edm::InputSource
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postEventReadFromSourceSignal_
 
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preEventReadFromSourceSignal_
 
- Protected Member Functions inherited from edm::PuttableSourceBase
void beginJob () override
 Begin protected makes it easier to do template programming. More...
 
- Protected Member Functions inherited from edm::InputSource
void decreaseRemainingEventsBy (int iSkipped)
 
bool eventCached () const
 
bool newLumi () const
 
bool newRun () const
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 
ProductRegistryproductRegistryUpdate ()
 
void reset () const
 
void resetEventCached ()
 
void resetLuminosityBlockAuxiliary (bool isNewLumi=true) const
 
void resetNewLumi ()
 
void resetNewRun ()
 
void resetRunAuxiliary (bool isNewRun=true) const
 
void setEventCached ()
 Called by the framework to merge or ached() const {return eventCached_;}. More...
 
void setLuminosityBlockAuxiliary (LuminosityBlockAuxiliary *lbp)
 
void setNewLumi ()
 
void setNewRun ()
 
void setRunAuxiliary (RunAuxiliary *rp)
 
void setTimestamp (Timestamp const &theTime)
 To set the current time, as seen by the input source. More...
 
virtual void skip (int offset)
 
ItemType state () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 

Detailed Description

Definition at line 19 of file DQMProtobufReader.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 22 of file DQMProtobufReader.h.

◆ MonitorElement

Definition at line 21 of file DQMProtobufReader.h.

Constructor & Destructor Documentation

◆ DQMProtobufReader()

DQMProtobufReader::DQMProtobufReader ( edm::ParameterSet const &  pset,
edm::InputSourceDescription const &  desc 
)
explicit

Definition at line 22 of file DQMProtobufReader.cc.

References flagDeleteDatFiles_, flagEndOfRunKills_, flagLoadFiles_, flagSkipFirstLumis_, and muonDTDigis_cfi::pset.

24  flagSkipFirstLumis_ = pset.getUntrackedParameter<bool>("skipFirstLumis");
25  flagEndOfRunKills_ = pset.getUntrackedParameter<bool>("endOfRunKills");
26  flagDeleteDatFiles_ = pset.getUntrackedParameter<bool>("deleteDatFiles");
27  flagLoadFiles_ = pset.getUntrackedParameter<bool>("loadFiles");
28 
29  produces<std::string, edm::Transition::BeginLuminosityBlock>("sourceDataPath");
30  produces<std::string, edm::Transition::BeginLuminosityBlock>("sourceJsonPath");
31  produces<DQMToken, edm::Transition::BeginRun>("DQMGenerationRecoRun");
32  produces<DQMToken, edm::Transition::BeginLuminosityBlock>("DQMGenerationRecoLumi");
33 }
PuttableSourceBase(ParameterSet const &, InputSourceDescription const &)

◆ ~DQMProtobufReader()

DQMProtobufReader::~DQMProtobufReader ( )
override

Definition at line 35 of file DQMProtobufReader.cc.

35 {}

Member Function Documentation

◆ beginLuminosityBlock()

void DQMProtobufReader::beginLuminosityBlock ( edm::LuminosityBlock lb)
overrideprivatevirtual

Reimplemented from edm::PuttableSourceBase.

Definition at line 114 of file DQMProtobufReader.cc.

References currentLumi_, fiterator_, flagLoadFiles_, dqmservices::DQMFileIterator::LumiEntry::get_data_path(), dqmservices::DQMFileIterator::LumiEntry::get_json_path(), dqm::implementation::IGetter::getAllContents(), load(), dqmservices::DQMFileIterator::logFileAction(), dqmservices::DQMFileIterator::logLumiState(), eostools::move(), castor_dqm_sourceclient_file_cfg::path, edm::LuminosityBlock::put(), and AlCaHLTBitMon_QueryRunRegistry::string.

114  {
116 
117  // clear the old lumi histograms
118  std::vector<MonitorElement*> allMEs = store->getAllContents("");
119  for (auto const& ME : allMEs) {
120  // We do not want to reset Run Products here!
121  if (ME->getLumiFlag()) {
122  ME->Reset();
123  }
124  }
125 
126  // load the new file
129 
130  std::unique_ptr<std::string> path_product(new std::string(path));
131  std::unique_ptr<std::string> json_product(new std::string(jspath));
132 
133  lb.put(std::move(path_product), "sourceDataPath");
134  lb.put(std::move(json_product), "sourceJsonPath");
135 
136  if (flagLoadFiles_) {
137  if (!std::filesystem::exists(path)) {
138  fiterator_.logFileAction("Data file is missing ", path);
139  fiterator_.logLumiState(currentLumi_, "error: data file missing");
140  return;
141  }
142 
143  fiterator_.logFileAction("Initiating request to open file ", path);
144  fiterator_.logFileAction("Successfully opened file ", path);
145  load(&*store, path);
146  fiterator_.logFileAction("Closed file ", path);
147  fiterator_.logLumiState(currentLumi_, "close: ok");
148  } else {
149  fiterator_.logFileAction("Not loading the data file at source level ", path);
150  fiterator_.logLumiState(currentLumi_, "close: not loading");
151  }
152 }
void load(DQMStore *store, std::string filename)
void logLumiState(const LumiEntry &lumi, const std::string &msg)
Definition: ME.h:11
void put(std::unique_ptr< PROD > product)
Put a new product.
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:609
DQMFileIterator::LumiEntry currentLumi_
void logFileAction(const std::string &msg, const std::string &fileName="") const
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

void DQMProtobufReader::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 282 of file DQMProtobufReader.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, edm::IDGeneratorSourceBase< PuttableSourceBase >::fillDescription(), and dqmservices::DQMFileIterator::fillDescription().

282  {
284 
285  desc.setComment(
286  "Creates runs and lumis and fills the dqmstore from protocol buffer "
287  "files.");
289 
290  desc.addUntracked<bool>("skipFirstLumis", false)
291  ->setComment(
292  "Skip (and ignore the minEventsPerLumi parameter) for the files "
293  "which have been available at the begining of the processing. "
294  "If set to true, the reader will open last available file for "
295  "processing.");
296 
297  desc.addUntracked<bool>("deleteDatFiles", false)
298  ->setComment(
299  "Delete data files after they have been closed, in order to "
300  "save disk space.");
301 
302  desc.addUntracked<bool>("endOfRunKills", false)
303  ->setComment(
304  "Kill the processing as soon as the end-of-run file appears, even if "
305  "there are/will be unprocessed lumisections.");
306 
307  desc.addUntracked<bool>("loadFiles", true)
308  ->setComment(
309  "Tells the source load the data files. If set to false, source will create skeleton lumi transitions.");
310 
312  descriptions.add("source", desc);
313 }
static void fillDescription(ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescription(edm::ParameterSetDescription &d)

◆ getNextItemType()

edm::InputSource::ItemType DQMProtobufReader::getNextItemType ( )
overrideprivatevirtual

Implements edm::InputSource.

Definition at line 37 of file DQMProtobufReader.cc.

References dqmservices::DQMFileIterator::delay(), fiterator_, flagEndOfRunKills_, load(), dqmservices::DQMFileIterator::logFileAction(), dqmservices::DQMFileIterator::lumiReady(), edm::shutdown_flag, dqmservices::DQMFileIterator::state(), and dqmservices::DQMFileIterator::update_state().

37  {
39  typedef DQMFileIterator::LumiEntry LumiEntry;
40 
41  // fiterator_.logFileAction("getNextItemType");
42 
43  for (;;) {
45 
46  if (edm::shutdown_flag.load()) {
47  fiterator_.logFileAction("Shutdown flag was set, shutting down.");
48  return InputSource::IsStop;
49  }
50 
51  // check for end of run file and force quit
52  if (flagEndOfRunKills_ && (fiterator_.state() != State::OPEN)) {
53  return InputSource::IsStop;
54  }
55 
56  // check for end of run and quit if everything has been processed.
57  // this is the clean exit
58  if ((!fiterator_.lumiReady()) && (fiterator_.state() == State::EOR)) {
59  return InputSource::IsStop;
60  }
61 
62  // skip to the next file if we have no files openned yet
63  if (fiterator_.lumiReady()) {
64  return InputSource::IsLumi;
65  }
66 
67  fiterator_.delay();
68  // BUG: for an unknown reason it fails after a certain time if we use
69  // IsSynchronize state
70  //
71  // comment out in order to block at this level
72  // return InputSource::IsSynchronize;
73  }
74 
75  // this is unreachable
76 }
void load(DQMStore *store, std::string filename)
volatile std::atomic< bool > shutdown_flag
void logFileAction(const std::string &msg, const std::string &fileName="") const

◆ load()

void DQMProtobufReader::load ( DQMStore store,
std::string  filename 
)
private

Definition at line 154 of file DQMProtobufReader.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book1DD(), dqm::implementation::IBooker::book1I(), dqm::implementation::IBooker::book1S(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::book2DD(), dqm::implementation::IBooker::book2I(), dqm::implementation::IBooker::book2S(), dqm::implementation::IBooker::book3D(), dqm::implementation::IBooker::bookFloat(), dqm::implementation::IBooker::bookInt(), dqm::implementation::IBooker::bookProfile(), dqm::implementation::IBooker::bookProfile2D(), dqm::implementation::IBooker::bookString(), visDQMUpload::buf, BTVHLTOfflineSource_cfi::dirname, DQMNet::DQM_PROP_LUMI, DQMNet::DQM_PROP_TYPE_INT, DQMNet::DQM_PROP_TYPE_MASK, DQMNet::DQM_PROP_TYPE_REAL, DQMNet::DQM_PROP_TYPE_STRING, DQMNet::DQM_PROP_TYPE_TH1D, DQMNet::DQM_PROP_TYPE_TH1F, DQMNet::DQM_PROP_TYPE_TH1I, DQMNet::DQM_PROP_TYPE_TH1S, DQMNet::DQM_PROP_TYPE_TH2D, DQMNet::DQM_PROP_TYPE_TH2F, DQMNet::DQM_PROP_TYPE_TH2I, DQMNet::DQM_PROP_TYPE_TH2S, DQMNet::DQM_PROP_TYPE_TH3F, DQMNet::DQM_PROP_TYPE_TPROF, DQMNet::DQM_PROP_TYPE_TPROF2D, corrVsCorr::filename, groupFilesInBlocks::fin, h, mps_fire::i, input, CalibrationSummaryClient_cfi::kind, match(), hlt_dqm_clientPB-live_cfg::me, getGTfromDQMFile::obj, convertSQLiteXML::ok, dqm::implementation::DQMStore::setCurrentFolder(), dqm::implementation::IBooker::setScope(), pickleFileParser::slash, str, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by beginLuminosityBlock(), and getNextItemType().

154  {
155  using google::protobuf::io::ArrayInputStream;
156  using google::protobuf::io::CodedInputStream;
157  using google::protobuf::io::FileInputStream;
158  using google::protobuf::io::FileOutputStream;
159  using google::protobuf::io::GzipInputStream;
160  using google::protobuf::io::GzipOutputStream;
161 
162  int filedescriptor;
163  if ((filedescriptor = ::open(filename.c_str(), O_RDONLY)) == -1) {
164  edm::LogError("DQMProtobufReader") << "File " << filename << " does not exist.";
165  }
166 
167  dqmstorepb::ROOTFilePB dqmstore_message;
168  FileInputStream fin(filedescriptor);
169  GzipInputStream input(&fin);
170  CodedInputStream input_coded(&input);
171  input_coded.SetTotalBytesLimit(1024 * 1024 * 1024);
172  if (!dqmstore_message.ParseFromCodedStream(&input_coded)) {
173  edm::LogError("DQMProtobufReader") << "Fatal parsing file '" << filename << "'";
174  }
175 
176  ::close(filedescriptor);
177 
178  for (int i = 0; i < dqmstore_message.histo_size(); ++i) {
179  TObject* obj = nullptr;
180  dqmstorepb::ROOTFilePB::Histo const& h = dqmstore_message.histo(i);
181 
182  size_t slash = h.full_pathname().rfind('/');
183  size_t dirpos = (slash == std::string::npos ? 0 : slash);
184  size_t namepos = (slash == std::string::npos ? 0 : slash + 1);
185  std::string objname, dirname;
186  dirname.assign(h.full_pathname(), 0, dirpos);
187  objname.assign(h.full_pathname(), namepos, std::string::npos);
188  TBufferFile buf(TBufferFile::kRead, h.size(), (void*)h.streamed_histo().data(), kFALSE);
189  buf.Reset();
190  if (buf.Length() == buf.BufferSize()) {
191  obj = nullptr;
192  } else {
193  buf.InitMap();
194  void* ptr = buf.ReadObjectAny(nullptr);
195  obj = reinterpret_cast<TObject*>(ptr);
196  }
197 
198  if (!obj) {
199  edm::LogError("DQMProtobufReader") << "Error reading element:'" << h.full_pathname();
200  }
201 
202  store->setCurrentFolder(dirname);
203 
204  if (h.flags() & DQMNet::DQM_PROP_LUMI) {
205  store->setScope(MonitorElementData::Scope::LUMI);
206  } else {
207  store->setScope(MonitorElementData::Scope::RUN);
208  }
209 
210  if (obj) {
211  int kind = h.flags() & DQMNet::DQM_PROP_TYPE_MASK;
213  MonitorElement* me = store->bookInt(objname);
214  auto expression = std::string(static_cast<TObjString*>(obj)->String().View());
215  std::regex parseint{"<.*>i=(.*)</.*>"};
216  std::smatch match;
217  bool ok = std::regex_match(expression, match, parseint);
218  if (!ok) {
219  edm::LogError("DQMProtobufReader") << "Malformed object of type INT: '" << expression << "'";
220  continue;
221  }
222  int value = std::atoi(match[1].str().c_str());
223  me->Fill(value);
224  } else if (kind == DQMNet::DQM_PROP_TYPE_REAL) {
225  MonitorElement* me = store->bookFloat(objname);
226  auto expression = std::string(static_cast<TObjString*>(obj)->String().View());
227  std::regex parsefloat{"<.*>f=(.*)</.*>"};
228  std::smatch match;
229  bool ok = std::regex_match(expression, match, parsefloat);
230  if (!ok) {
231  edm::LogError("DQMProtobufReader") << "Malformed object of type REAL: '" << expression << "'";
232  continue;
233  }
234  double value = std::atof(match[1].str().c_str());
235  me->Fill(value);
236  } else if (kind == DQMNet::DQM_PROP_TYPE_STRING) {
237  auto value = static_cast<TObjString*>(obj)->String();
238  store->bookString(objname, value);
239  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1F) {
240  auto value = static_cast<TH1F*>(obj);
241  store->book1D(objname, value);
242  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1S) {
243  auto value = static_cast<TH1S*>(obj);
244  store->book1S(objname, value);
245  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1D) {
246  auto value = static_cast<TH1D*>(obj);
247  store->book1DD(objname, value);
248  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1I) {
249  auto value = static_cast<TH1I*>(obj);
250  store->book1I(objname, value);
251  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2F) {
252  auto value = static_cast<TH2F*>(obj);
253  store->book2D(objname, value);
254  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2S) {
255  auto value = static_cast<TH2S*>(obj);
256  store->book2S(objname, value);
257  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2D) {
258  auto value = static_cast<TH2D*>(obj);
259  store->book2DD(objname, value);
260  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2I) {
261  auto value = static_cast<TH2I*>(obj);
262  store->book2I(objname, value);
263  } else if (kind == DQMNet::DQM_PROP_TYPE_TH3F) {
264  auto value = static_cast<TH3F*>(obj);
265  store->book3D(objname, value);
266  } else if (kind == DQMNet::DQM_PROP_TYPE_TPROF) {
267  auto value = static_cast<TProfile*>(obj);
268  store->bookProfile(objname, value);
269  } else if (kind == DQMNet::DQM_PROP_TYPE_TPROF2D) {
270  auto value = static_cast<TProfile2D*>(obj);
271  store->bookProfile2D(objname, value);
272  } else {
273  edm::LogError("DQMProtobufReader") << "Unknown type: " << kind;
274  }
275  delete obj;
276  }
277  }
278 }
static const uint32_t DQM_PROP_TYPE_TH1S
Definition: DQMNet.h:35
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
static const uint32_t DQM_PROP_TYPE_TPROF
Definition: DQMNet.h:45
MonitorElement * book1I(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:254
static const uint32_t DQM_PROP_TYPE_TH2D
Definition: DQMNet.h:40
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
Definition: DQMStore.cc:46
static const uint32_t DQM_PROP_TYPE_TH3F
Definition: DQMNet.h:42
static const uint32_t DQM_PROP_TYPE_TH1F
Definition: DQMNet.h:34
Log< level::Error, false > LogError
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
static std::string const input
Definition: EdmProvDump.cc:47
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
static const uint32_t DQM_PROP_TYPE_INT
Definition: DQMNet.h:31
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
MonitorElement * book1S(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:133
Definition: value.py:1
static const uint32_t DQM_PROP_TYPE_TH1D
Definition: DQMNet.h:36
static const uint32_t DQM_PROP_TYPE_TH1I
Definition: DQMNet.h:37
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:338
static const uint32_t DQM_PROP_TYPE_TH2S
Definition: DQMNet.h:39
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
static const uint32_t DQM_PROP_TYPE_STRING
Definition: DQMNet.h:33
static const uint32_t DQM_PROP_TYPE_MASK
Definition: DQMNet.h:28
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
#define str(s)
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
Definition: DQMStore.h:367
MonitorElement * book2I(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:296
static const uint32_t DQM_PROP_LUMI
Definition: DQMNet.h:63
static const uint32_t DQM_PROP_TYPE_TH2I
Definition: DQMNet.h:41
static const uint32_t DQM_PROP_TYPE_REAL
Definition: DQMNet.h:32
static const uint32_t DQM_PROP_TYPE_TPROF2D
Definition: DQMNet.h:46
static const uint32_t DQM_PROP_TYPE_TH2F
Definition: DQMNet.h:38

◆ logFileAction()

void dqmservices::DQMProtobufReader::logFileAction ( char const *  msg,
char const *  fileName 
) const
private

◆ prepareNextFile()

bool dqmservices::DQMProtobufReader::prepareNextFile ( )
private

◆ readEvent_()

void DQMProtobufReader::readEvent_ ( edm::EventPrincipal )
overrideprivatevirtual

Implements edm::InputSource.

Definition at line 280 of file DQMProtobufReader.cc.

280 {};

◆ readLuminosityBlock_()

void DQMProtobufReader::readLuminosityBlock_ ( edm::LuminosityBlockPrincipal lbCache)
overrideprivatevirtual

Reimplemented from edm::InputSource.

Definition at line 106 of file DQMProtobufReader.cc.

References edm::LuminosityBlockPrincipal::aux(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), edm::LuminosityBlockPrincipal::id(), edm::LuminosityBlockID::luminosityBlock(), edm::LuminosityBlockAuxiliary::processHistoryID(), edm::InputSource::processHistoryRegistry(), edm::JobReport::reportInputLumiSection(), and edm::LuminosityBlockID::run().

106  {
107  // fiterator_.logFileAction("readLuminosityBlock_");
108 
110  jr->reportInputLumiSection(lbCache.id().run(), lbCache.id().luminosityBlock());
112 }
LuminosityBlockNumber_t luminosityBlock() const
void fillLuminosityBlockPrincipal(ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
ProcessHistoryID const & processHistoryID() const
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
Definition: JobReport.cc:465
RunNumber_t run() const
ProcessHistoryRegistry const & processHistoryRegistry() const
Accessors for process history registry.
Definition: InputSource.h:140
LuminosityBlockAuxiliary const & aux() const

◆ readLuminosityBlockAuxiliary_()

std::shared_ptr< edm::LuminosityBlockAuxiliary > DQMProtobufReader::readLuminosityBlockAuxiliary_ ( )
overrideprivatevirtual

◆ readRun_()

void DQMProtobufReader::readRun_ ( edm::RunPrincipal rpCache)
overrideprivatevirtual

Reimplemented from edm::InputSource.

Definition at line 85 of file DQMProtobufReader.cc.

References edm::RunPrincipal::fillRunPrincipal(), dqm::implementation::IGetter::getAllContents(), and edm::InputSource::processHistoryRegistryForUpdate().

85  {
86  // fiterator_.logFileAction("readRun_");
88 
90  std::vector<MonitorElement*> allMEs = store->getAllContents("");
91  for (auto const& ME : allMEs) {
92  ME->Reset();
93  }
94 }
Definition: ME.h:11
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:609
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:329
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
Definition: RunPrincipal.cc:28

◆ readRunAuxiliary_()

std::shared_ptr< edm::RunAuxiliary > DQMProtobufReader::readRunAuxiliary_ ( )
overrideprivatevirtual

Implements edm::InputSource.

Definition at line 78 of file DQMProtobufReader.cc.

References printConversionInfo::aux, fiterator_, and dqmservices::DQMFileIterator::runNumber().

78  {
79  // fiterator_.logFileAction("readRunAuxiliary_");
80 
82  return std::shared_ptr<edm::RunAuxiliary>(aux);
83 }

Member Data Documentation

◆ currentLumi_

DQMFileIterator::LumiEntry dqmservices::DQMProtobufReader::currentLumi_
private

Definition at line 50 of file DQMProtobufReader.h.

Referenced by beginLuminosityBlock(), and readLuminosityBlockAuxiliary_().

◆ fiterator_

DQMFileIterator dqmservices::DQMProtobufReader::fiterator_
private

◆ flagDeleteDatFiles_

bool dqmservices::DQMProtobufReader::flagDeleteDatFiles_
private

Definition at line 45 of file DQMProtobufReader.h.

Referenced by DQMProtobufReader().

◆ flagEndOfRunKills_

bool dqmservices::DQMProtobufReader::flagEndOfRunKills_
private

Definition at line 44 of file DQMProtobufReader.h.

Referenced by DQMProtobufReader(), and getNextItemType().

◆ flagLoadFiles_

bool dqmservices::DQMProtobufReader::flagLoadFiles_
private

Definition at line 46 of file DQMProtobufReader.h.

Referenced by beginLuminosityBlock(), and DQMProtobufReader().

◆ flagSkipFirstLumis_

bool dqmservices::DQMProtobufReader::flagSkipFirstLumis_
private

Definition at line 43 of file DQMProtobufReader.h.

Referenced by DQMProtobufReader().

◆ nextItemType

InputSource::ItemType dqmservices::DQMProtobufReader::nextItemType
private

Definition at line 52 of file DQMProtobufReader.h.

◆ streamReader_

std::unique_ptr<double> dqmservices::DQMProtobufReader::streamReader_
private

Definition at line 48 of file DQMProtobufReader.h.