CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
dqm::DQMFileSaverPB Class Reference

#include <DQMFileSaverPB.h>

Inheritance diagram for dqm::DQMFileSaverPB:
dqm::DQMFileSaverBase edm::global::EDAnalyzer< edm::RunCache< NoCache >, edm::LuminosityBlockCache< NoCache > > edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DQMFileSaverPB (const edm::ParameterSet &ps)
 
 ~DQMFileSaverPB () override
 
- Public Member Functions inherited from dqm::DQMFileSaverBase
 DQMFileSaverBase (const edm::ParameterSet &ps)
 
 ~DQMFileSaverBase () override
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::RunCache< NoCache >, edm::LuminosityBlockCache< NoCache > >
 EDAnalyzer ()=default
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static boost::property_tree::ptree fillJson (int run, int lumi, const std::string &dataFilePathName, const std::string &transferDestinationStr, const std::string &mergeTypeStr, evf::FastMonitoringService *fms)
 
- Static Public Member Functions inherited from dqm::DQMFileSaverBase
static void fillDescription (edm::ParameterSetDescription &d)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void initRun () const override
 
void saveLumi (const FileParameters &fp) const override
 
void saveRun (const FileParameters &fp) const override
 
- Protected Member Functions inherited from dqm::DQMFileSaverBase
void analyze (edm::StreamID, const edm::Event &e, const edm::EventSetup &) const final
 
std::shared_ptr< NoCacheglobalBeginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) const final
 
std::shared_ptr< NoCacheglobalBeginRun (const edm::Run &, const edm::EventSetup &) const final
 
void globalEndLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) const final
 
void globalEndRun (const edm::Run &, const edm::EventSetup &) const final
 
void logFileAction (const std::string &msg, const std::string &fileName) const
 
void saveJobReport (const std::string &filename) const
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 

Protected Attributes

bool fakeFilterUnitMode_
 
std::string mergeType_
 
std::string streamLabel_
 
std::string transferDestination_
 
- Protected Attributes inherited from dqm::DQMFileSaverBase
FileParameters initial_fp_
 
std::mutex initial_fp_lock_
 

Additional Inherited Members

- Public Types inherited from dqm::DQMFileSaverBase
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Protected Member Functions inherited from dqm::DQMFileSaverBase
static const std::string filename (const FileParameters &fp, bool useLumi=false)
 

Detailed Description

Definition at line 15 of file DQMFileSaverPB.h.

Constructor & Destructor Documentation

DQMFileSaverPB::DQMFileSaverPB ( const edm::ParameterSet ps)

Definition at line 26 of file DQMFileSaverPB.cc.

References fakeFilterUnitMode_, edm::ParameterSet::getUntrackedParameter(), mergeType_, streamLabel_, AlCaHLTBitMon_QueryRunRegistry::string, transferDestination_, and ~DQMFileSaverPB().

26  : DQMFileSaverBase(ps) {
27  fakeFilterUnitMode_ = ps.getUntrackedParameter<bool>("fakeFilterUnitMode", false);
28  streamLabel_ = ps.getUntrackedParameter<std::string>("streamLabel", "streamDQMHistograms");
29 
31  mergeType_ = "";
32 }
DQMFileSaverBase(const edm::ParameterSet &ps)
std::string streamLabel_
T getUntrackedParameter(std::string const &, T const &) const
std::string transferDestination_
std::string mergeType_
DQMFileSaverPB::~DQMFileSaverPB ( )
overridedefault

Referenced by DQMFileSaverPB().

Member Function Documentation

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

Definition at line 178 of file DQMFileSaverPB.cc.

References edm::ConfigurationDescriptions::addDefault(), edm::ParameterSetDescription::addUntracked(), DEFINE_FWK_MODULE, dqm::DQMFileSaverBase::fillDescription(), edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

178  {
180  desc.setComment("Saves histograms from DQM store, HLT->pb workflow.");
181 
182  desc.addUntracked<bool>("fakeFilterUnitMode", false)->setComment("If set, EvFDaqDirector is emulated and not used.");
183 
184  desc.addUntracked<std::string>("streamLabel", "streamDQMHistograms")->setComment("Label of the stream.");
185 
187 
188  // Changed to use addDefault instead of add here because previously
189  // DQMFileSaverOnline and DQMFileSaverPB both used the module label
190  // "saver" which caused conflicting cfi filenames to be generated.
191  // add could be used if unique module labels were given.
192  descriptions.addDefault(desc);
193 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setComment(std::string const &value)
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescription(edm::ParameterSetDescription &d)
boost::property_tree::ptree DQMFileSaverPB::fillJson ( int  run,
int  lumi,
const std::string &  dataFilePathName,
const std::string &  transferDestinationStr,
const std::string &  mergeTypeStr,
evf::FastMonitoringService fms 
)
static

Definition at line 96 of file DQMFileSaverPB.cc.

References data, Exception, evf::FastMonitoringService::getEventsProcessedForLumi(), query::host, varParsingExample::inputFiles, castor_dqm_sourceclient_file_cfg::path, DiDispStaMuonMonitor_cfi::pt, hgcalPlots::stat, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by saveLumi().

101  {
102  namespace bpt = boost::property_tree;
103  namespace bfs = boost::filesystem;
104 
105  bpt::ptree pt;
106 
107  int hostnameReturn;
108  char host[32];
109  hostnameReturn = gethostname(host, sizeof(host));
110  if (hostnameReturn == -1)
111  throw cms::Exception("fillJson") << "Internal error, cannot get host name";
112 
113  int pid = getpid();
114  std::ostringstream oss_pid;
115  oss_pid << pid;
116 
117  int nProcessed = fms ? (fms->getEventsProcessedForLumi(lumi)) : -1;
118 
119  // Stat the data file: if not there, throw
120  std::string dataFileName;
121  struct stat dataFileStat;
122  dataFileStat.st_size = 0;
123  if (nProcessed) {
124  if (stat(dataFilePathName.c_str(), &dataFileStat) != 0)
125  throw cms::Exception("fillJson") << "Internal error, cannot get data file: " << dataFilePathName;
126  // Extract only the data file name from the full path
127  dataFileName = bfs::path(dataFilePathName).filename().string();
128  }
129  // The availability test of the FastMonitoringService was done in the ctor.
130  bpt::ptree data;
131  bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize, inputFiles, fileAdler32,
132  transferDestination, mergeType, hltErrorEvents;
133 
134  processedEvents.put("", nProcessed); // Processed events
135  acceptedEvents.put("", nProcessed); // Accepted events, same as processed for our purposes
136 
137  errorEvents.put("", 0); // Error events
138  bitmask.put("", 0); // Bitmask of abs of CMSSW return code
139  fileList.put("", dataFileName); // Data file the information refers to
140  fileSize.put("", dataFileStat.st_size); // Size in bytes of the data file
141  inputFiles.put("", ""); // We do not care about input files!
142  fileAdler32.put("", -1); // placeholder to match output json definition
143  transferDestination.put("", transferDestinationStr); // SM Transfer destination field
144  mergeType.put("", mergeTypeStr); // SM Transfer destination field
145  hltErrorEvents.put("", 0); // Error events
146 
147  data.push_back(std::make_pair("", processedEvents));
148  data.push_back(std::make_pair("", acceptedEvents));
149  data.push_back(std::make_pair("", errorEvents));
150  data.push_back(std::make_pair("", bitmask));
151  data.push_back(std::make_pair("", fileList));
152  data.push_back(std::make_pair("", fileSize));
153  data.push_back(std::make_pair("", inputFiles));
154  data.push_back(std::make_pair("", fileAdler32));
155  data.push_back(std::make_pair("", transferDestination));
156  data.push_back(std::make_pair("", mergeType));
157  data.push_back(std::make_pair("", hltErrorEvents));
158 
159  pt.add_child("data", data);
160 
161  if (fms == nullptr) {
162  pt.put("definition", "/fakeDefinition.jsn");
163  } else {
164  // The availability test of the EvFDaqDirector Service was done in the ctor.
165  bfs::path outJsonDefName{
166  edm::Service<evf::EvFDaqDirector>()->baseRunDir()}; //we assume this file is written bu the EvF Output module
167  outJsonDefName /= (std::string("output_") + oss_pid.str() + std::string(".jsd"));
168  pt.put("definition", outJsonDefName.string());
169  }
170 
171  char sourceInfo[64]; //host and pid information
172  sprintf(sourceInfo, "%s_%d", host, pid);
173  pt.put("source", sourceInfo);
174 
175  return pt;
176 }
host
Definition: query.py:115
unsigned int getEventsProcessedForLumi(unsigned int lumi, bool *abortFlag=0)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
void DQMFileSaverPB::initRun ( ) const
overrideprotectedvirtual
void DQMFileSaverPB::saveLumi ( const FileParameters fp) const
overrideprotectedvirtual

Reimplemented from dqm::DQMFileSaverBase.

Definition at line 43 of file DQMFileSaverPB.cc.

References fakeFilterUnitMode_, fillJson(), dqm-mbProfile::format, evf::FastMonitoringService::getEventsProcessedForLumi(), dqm::DQMFileSaverBase::FileParameters::lumi_, mergeType_, dqm::dqmstoreimpl::DQMStore::mtEnabled(), dqm::DQMFileSaverBase::FileParameters::path_, DiDispStaMuonMonitor_cfi::pt, dqm::DQMFileSaverBase::FileParameters::run_, dqm::dqmstoreimpl::DQMStore::savePB(), str, streamLabel_, AlCaHLTBitMon_QueryRunRegistry::string, and transferDestination_.

43  {
44  // get from DAQ2 services where to store the files according to their format
45  namespace bpt = boost::property_tree;
46 
47  std::string openJsonFilePathName;
48  std::string jsonFilePathName;
49  std::string openHistoFilePathName;
50  std::string histoFilePathName;
51 
52  evf::FastMonitoringService* fms = nullptr;
54 
55  // create the files names
56  if (fakeFilterUnitMode_) {
57  std::string runDir = str(boost::format("%s/run%06d") % fp.path_ % fp.run_);
58  std::string baseName = str(boost::format("%s/run%06d_ls%04d_%s") % runDir % fp.run_ % fp.lumi_ % streamLabel_);
59 
60  boost::filesystem::create_directories(runDir);
61 
62  jsonFilePathName = baseName + ".jsn";
63  openJsonFilePathName = jsonFilePathName + ".open";
64 
65  histoFilePathName = baseName + ".pb";
66  openHistoFilePathName = histoFilePathName + ".open";
67  } else {
68  openJsonFilePathName = edm::Service<evf::EvFDaqDirector>()->getOpenOutputJsonFilePath(fp.lumi_, streamLabel_);
69  jsonFilePathName = edm::Service<evf::EvFDaqDirector>()->getOutputJsonFilePath(fp.lumi_, streamLabel_);
70 
71  openHistoFilePathName =
72  edm::Service<evf::EvFDaqDirector>()->getOpenProtocolBufferHistogramFilePath(fp.lumi_, streamLabel_);
73  histoFilePathName = edm::Service<evf::EvFDaqDirector>()->getProtocolBufferHistogramFilePath(fp.lumi_, streamLabel_);
74 
76  }
77 
78  if (fms ? fms->getEventsProcessedForLumi(fp.lumi_) : true) {
79  // Save the file in the open directory.
80  store->savePB(openHistoFilePathName, "", store->mtEnabled() ? fp.run_ : 0, fp.lumi_);
81 
82  // Now move the the data and json files into the output directory.
83  ::rename(openHistoFilePathName.c_str(), histoFilePathName.c_str());
84  }
85 
86  // Write the json file in the open directory.
87  bpt::ptree pt = fillJson(fp.run_, fp.lumi_, histoFilePathName, transferDestination_, mergeType_, fms);
88  write_json(openJsonFilePathName, pt);
89  ::rename(openJsonFilePathName.c_str(), jsonFilePathName.c_str());
90 }
std::string streamLabel_
unsigned int getEventsProcessedForLumi(unsigned int lumi, bool *abortFlag=0)
std::string transferDestination_
void savePB(std::string const &filename, std::string const &path="", uint32_t run=0, uint32_t lumi=0)
Definition: DQMStore.cc:2413
#define str(s)
static boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string &transferDestinationStr, const std::string &mergeTypeStr, evf::FastMonitoringService *fms)
std::string mergeType_
void DQMFileSaverPB::saveRun ( const FileParameters fp) const
overrideprotectedvirtual

Reimplemented from dqm::DQMFileSaverBase.

Definition at line 92 of file DQMFileSaverPB.cc.

92  {
93  // no saving for the run
94 }

Member Data Documentation

bool dqm::DQMFileSaverPB::fakeFilterUnitMode_
protected

Definition at line 34 of file DQMFileSaverPB.h.

Referenced by DQMFileSaverPB(), initRun(), and saveLumi().

std::string dqm::DQMFileSaverPB::mergeType_
mutableprotected

Definition at line 37 of file DQMFileSaverPB.h.

Referenced by DQMFileSaverPB(), initRun(), and saveLumi().

std::string dqm::DQMFileSaverPB::streamLabel_
protected

Definition at line 35 of file DQMFileSaverPB.h.

Referenced by DQMFileSaverPB(), initRun(), and saveLumi().

std::string dqm::DQMFileSaverPB::transferDestination_
mutableprotected

Definition at line 36 of file DQMFileSaverPB.h.

Referenced by DQMFileSaverPB(), initRun(), and saveLumi().