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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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=default
 
- 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...
 
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)
 
void switchTo (std::shared_ptr< ProductRegistry > iOther)
 switch to a different ProductRegistry. More...
 
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 const flagDeleteDatFiles_
 
bool const flagEndOfRunKills_
 
bool const flagLoadFiles_
 
bool const flagSkipFirstLumis_
 

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 12 of file DQMProtobufReader.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 15 of file DQMProtobufReader.h.

◆ MonitorElement

Definition at line 14 of file DQMProtobufReader.h.

Constructor & Destructor Documentation

◆ DQMProtobufReader()

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

Definition at line 28 of file DQMProtobufReader.cc.

31  flagSkipFirstLumis_(pset.getUntrackedParameter<bool>("skipFirstLumis")),
32  flagEndOfRunKills_(pset.getUntrackedParameter<bool>("endOfRunKills")),
33  flagDeleteDatFiles_(pset.getUntrackedParameter<bool>("deleteDatFiles")),
34  flagLoadFiles_(pset.getUntrackedParameter<bool>("loadFiles")) {
35  produces<std::string, edm::Transition::BeginLuminosityBlock>("sourceDataPath");
36  produces<std::string, edm::Transition::BeginLuminosityBlock>("sourceJsonPath");
37  produces<DQMToken, edm::Transition::BeginRun>("DQMGenerationRecoRun");
38  produces<DQMToken, edm::Transition::BeginLuminosityBlock>("DQMGenerationRecoLumi");
39 }
PuttableSourceBase(ParameterSet const &, InputSourceDescription const &)

◆ ~DQMProtobufReader()

dqmservices::DQMProtobufReader::~DQMProtobufReader ( )
overridedefault

Member Function Documentation

◆ beginLuminosityBlock()

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

Reimplemented from edm::PuttableSourceBase.

Definition at line 118 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.

118  {
120 
121  // clear the old lumi histograms
122  std::vector<MonitorElement*> allMEs = store->getAllContents("");
123  for (auto const& ME : allMEs) {
124  // We do not want to reset Run Products here!
125  if (ME->getLumiFlag()) {
126  ME->Reset();
127  }
128  }
129 
130  // load the new file
133 
134  std::unique_ptr<std::string> path_product(new std::string(path));
135  std::unique_ptr<std::string> json_product(new std::string(jspath));
136 
137  lb.put(std::move(path_product), "sourceDataPath");
138  lb.put(std::move(json_product), "sourceJsonPath");
139 
140  if (flagLoadFiles_) {
141  if (!std::filesystem::exists(path)) {
142  fiterator_.logFileAction("Data file is missing ", path);
143  fiterator_.logLumiState(currentLumi_, "error: data file missing");
144  return;
145  }
146 
147  fiterator_.logFileAction("Initiating request to open file ", path);
148  fiterator_.logFileAction("Successfully opened file ", path);
149  load(&*store, path);
150  fiterator_.logFileAction("Closed file ", path);
151  fiterator_.logLumiState(currentLumi_, "close: ok");
152  } else {
153  fiterator_.logFileAction("Not loading the data file at source level ", path);
154  fiterator_.logLumiState(currentLumi_, "close: not loading");
155  }
156 }
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:641
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 286 of file DQMProtobufReader.cc.

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

286  {
288 
289  desc.setComment("Creates runs and lumis and fills the dqmstore from protocol buffer files.");
291 
292  desc.addUntracked<bool>("skipFirstLumis", false)
293  ->setComment(
294  "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the begining of "
295  "the processing. If set to true, the reader will open last available file for processing.");
296 
297  desc.addUntracked<bool>("deleteDatFiles", false)
298  ->setComment("Delete data files after they have been closed, in order to save disk space.");
299 
300  desc.addUntracked<bool>("endOfRunKills", false)
301  ->setComment(
302  "Kill the processing as soon as the end-of-run file appears, even if there are/will be unprocessed "
303  "lumisections.");
304 
305  desc.addUntracked<bool>("loadFiles", true)
306  ->setComment(
307  "Tells the source to load the data files. If set to False, the source will create skeleton lumi "
308  "transitions.");
309 
311  descriptions.add("source", desc);
312 }
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 41 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().

41  {
43  typedef DQMFileIterator::LumiEntry LumiEntry;
44 
45  // fiterator_.logFileAction("getNextItemType");
46 
47  for (;;) {
49 
50  if (edm::shutdown_flag.load()) {
51  fiterator_.logFileAction("Shutdown flag was set, shutting down.");
52  return InputSource::IsStop;
53  }
54 
55  // check for end of run file and force quit
56  if (flagEndOfRunKills_ && (fiterator_.state() != State::OPEN)) {
57  return InputSource::IsStop;
58  }
59 
60  // check for end of run and quit if everything has been processed.
61  // this is the clean exit
62  if ((!fiterator_.lumiReady()) && (fiterator_.state() == State::EOR)) {
63  return InputSource::IsStop;
64  }
65 
66  // skip to the next file if we have no files openned yet
67  if (fiterator_.lumiReady()) {
68  return InputSource::IsLumi;
69  }
70 
71  fiterator_.delay();
72  // BUG: for an unknown reason it fails after a certain time if we use
73  // IsSynchronize state
74  //
75  // comment out in order to block at this level
76  // return InputSource::IsSynchronize;
77  }
78 
79  // this is unreachable
80 }
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 158 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, l1tGTMenu_hadr_metSeeds_cff::expression, corrVsCorr::filename, groupFilesInBlocks::fin, h, dqmstorepb::ROOTFilePB::histo(), dqmstorepb::ROOTFilePB::histo_size(), mps_fire::i, input, CalibrationSummaryClient_cfi::kind, 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().

158  {
159  using google::protobuf::io::ArrayInputStream;
160  using google::protobuf::io::CodedInputStream;
161  using google::protobuf::io::FileInputStream;
162  using google::protobuf::io::FileOutputStream;
163  using google::protobuf::io::GzipInputStream;
164  using google::protobuf::io::GzipOutputStream;
165 
166  int filedescriptor;
167  if ((filedescriptor = ::open(filename.c_str(), O_RDONLY)) == -1) {
168  edm::LogError("DQMProtobufReader") << "File " << filename << " does not exist.";
169  }
170 
171  dqmstorepb::ROOTFilePB dqmstore_message;
172  FileInputStream fin(filedescriptor);
173  GzipInputStream input(&fin);
174  CodedInputStream input_coded(&input);
175  input_coded.SetTotalBytesLimit(1024 * 1024 * 1024);
176  if (!dqmstore_message.ParseFromCodedStream(&input_coded)) {
177  edm::LogError("DQMProtobufReader") << "Fatal parsing file '" << filename << "'";
178  }
179 
180  ::close(filedescriptor);
181 
182  for (int i = 0; i < dqmstore_message.histo_size(); ++i) {
183  TObject* obj = nullptr;
184  dqmstorepb::ROOTFilePB::Histo const& h = dqmstore_message.histo(i);
185 
186  size_t slash = h.full_pathname().rfind('/');
187  size_t dirpos = (slash == std::string::npos ? 0 : slash);
188  size_t namepos = (slash == std::string::npos ? 0 : slash + 1);
189  std::string objname, dirname;
190  dirname.assign(h.full_pathname(), 0, dirpos);
191  objname.assign(h.full_pathname(), namepos, std::string::npos);
192  TBufferFile buf(TBufferFile::kRead, h.size(), (void*)h.streamed_histo().data(), kFALSE);
193  buf.Reset();
194  if (buf.Length() == buf.BufferSize()) {
195  obj = nullptr;
196  } else {
197  buf.InitMap();
198  void* ptr = buf.ReadObjectAny(nullptr);
199  obj = reinterpret_cast<TObject*>(ptr);
200  }
201 
202  if (!obj) {
203  edm::LogError("DQMProtobufReader") << "Error reading element:'" << h.full_pathname();
204  }
205 
206  store->setCurrentFolder(dirname);
207 
208  if (h.flags() & DQMNet::DQM_PROP_LUMI) {
209  store->setScope(MonitorElementData::Scope::LUMI);
210  } else {
211  store->setScope(MonitorElementData::Scope::RUN);
212  }
213 
214  if (obj) {
215  int kind = h.flags() & DQMNet::DQM_PROP_TYPE_MASK;
217  MonitorElement* me = store->bookInt(objname);
218  auto expression = std::string(static_cast<TObjString*>(obj)->String().View());
219  std::regex parseint{"<.*>i=(.*)</.*>"};
220  std::smatch match;
221  bool ok = std::regex_match(expression, match, parseint);
222  if (!ok) {
223  edm::LogError("DQMProtobufReader") << "Malformed object of type INT: '" << expression << "'";
224  continue;
225  }
226  int value = std::atoi(match[1].str().c_str());
227  me->Fill(value);
228  } else if (kind == DQMNet::DQM_PROP_TYPE_REAL) {
229  MonitorElement* me = store->bookFloat(objname);
230  auto expression = std::string(static_cast<TObjString*>(obj)->String().View());
231  std::regex parsefloat{"<.*>f=(.*)</.*>"};
232  std::smatch match;
233  bool ok = std::regex_match(expression, match, parsefloat);
234  if (!ok) {
235  edm::LogError("DQMProtobufReader") << "Malformed object of type REAL: '" << expression << "'";
236  continue;
237  }
238  double value = std::atof(match[1].str().c_str());
239  me->Fill(value);
240  } else if (kind == DQMNet::DQM_PROP_TYPE_STRING) {
241  auto value = static_cast<TObjString*>(obj)->String();
242  store->bookString(objname, value);
243  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1F) {
244  auto value = static_cast<TH1F*>(obj);
245  store->book1D(objname, value);
246  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1S) {
247  auto value = static_cast<TH1S*>(obj);
248  store->book1S(objname, value);
249  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1D) {
250  auto value = static_cast<TH1D*>(obj);
251  store->book1DD(objname, value);
252  } else if (kind == DQMNet::DQM_PROP_TYPE_TH1I) {
253  auto value = static_cast<TH1I*>(obj);
254  store->book1I(objname, value);
255  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2F) {
256  auto value = static_cast<TH2F*>(obj);
257  store->book2D(objname, value);
258  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2S) {
259  auto value = static_cast<TH2S*>(obj);
260  store->book2S(objname, value);
261  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2D) {
262  auto value = static_cast<TH2D*>(obj);
263  store->book2DD(objname, value);
264  } else if (kind == DQMNet::DQM_PROP_TYPE_TH2I) {
265  auto value = static_cast<TH2I*>(obj);
266  store->book2I(objname, value);
267  } else if (kind == DQMNet::DQM_PROP_TYPE_TH3F) {
268  auto value = static_cast<TH3F*>(obj);
269  store->book3D(objname, value);
270  } else if (kind == DQMNet::DQM_PROP_TYPE_TPROF) {
271  auto value = static_cast<TProfile*>(obj);
272  store->bookProfile(objname, value);
273  } else if (kind == DQMNet::DQM_PROP_TYPE_TPROF2D) {
274  auto value = static_cast<TProfile2D*>(obj);
275  store->bookProfile2D(objname, value);
276  } else {
277  edm::LogError("DQMProtobufReader") << "Unknown type: " << kind;
278  }
279  delete obj;
280  }
281  }
282 }
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:50
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:50
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
const ::dqmstorepb::ROOTFilePB_Histo & histo(int index) const
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 284 of file DQMProtobufReader.cc.

284 {};

◆ readLuminosityBlock_()

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

Reimplemented from edm::InputSource.

Definition at line 110 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().

110  {
111  // fiterator_.logFileAction("readLuminosityBlock_");
112 
114  jr->reportInputLumiSection(lbCache.id().run(), lbCache.id().luminosityBlock());
116 }
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:501
RunNumber_t run() const
ProcessHistoryRegistry const & processHistoryRegistry() const
Accessors for process history registry.
Definition: InputSource.h:139
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 89 of file DQMProtobufReader.cc.

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

89  {
90  // fiterator_.logFileAction("readRun_");
92 
94  std::vector<MonitorElement*> allMEs = store->getAllContents("");
95  for (auto const& ME : allMEs) {
96  ME->Reset();
97  }
98 }
Definition: ME.h:11
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:641
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:331
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
Definition: RunPrincipal.cc:25

◆ readRunAuxiliary_()

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

Implements edm::InputSource.

Definition at line 82 of file DQMProtobufReader.cc.

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

82  {
83  // fiterator_.logFileAction("readRunAuxiliary_");
84 
86  return std::shared_ptr<edm::RunAuxiliary>(aux);
87 }
unsigned int runNumber() const

Member Data Documentation

◆ currentLumi_

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

Definition at line 38 of file DQMProtobufReader.h.

Referenced by beginLuminosityBlock(), and readLuminosityBlockAuxiliary_().

◆ fiterator_

DQMFileIterator dqmservices::DQMProtobufReader::fiterator_
private

◆ flagDeleteDatFiles_

bool const dqmservices::DQMProtobufReader::flagDeleteDatFiles_
private

Definition at line 42 of file DQMProtobufReader.h.

◆ flagEndOfRunKills_

bool const dqmservices::DQMProtobufReader::flagEndOfRunKills_
private

Definition at line 41 of file DQMProtobufReader.h.

Referenced by getNextItemType().

◆ flagLoadFiles_

bool const dqmservices::DQMProtobufReader::flagLoadFiles_
private

Definition at line 43 of file DQMProtobufReader.h.

Referenced by beginLuminosityBlock().

◆ flagSkipFirstLumis_

bool const dqmservices::DQMProtobufReader::flagSkipFirstLumis_
private

Definition at line 40 of file DQMProtobufReader.h.