CMS 3D CMS Logo

JsonWritingTimeoutPoolOutputModule.cc
Go to the documentation of this file.
2 
5 
6 #include <boost/format.hpp>
7 #include <boost/filesystem.hpp>
8 #include <boost/property_tree/json_parser.hpp>
9 #include <boost/property_tree/ptree.hpp>
10 
11 namespace dqmservices {
12 
14  : edm::one::OutputModuleBase::OutputModuleBase(ps), edm::TimeoutPoolOutputModule(ps) {
15  runNumber_ = ps.getUntrackedParameter<uint32_t>("runNumber");
16  outputPath_ = ps.getUntrackedParameter<std::string>("outputPath");
17  streamLabel_ = ps.getUntrackedParameter<std::string>("streamLabel");
18 
19  sequence_ = 0;
20  }
21 
23  sequence_++;
24 
25  std::string base = str(boost::format("run%06d_ls%04d_%s") % runNumber_ % sequence_ % streamLabel_);
26 
28 
29  currentFileName_ = (p / base).string() + ".root";
30  currentJsonName_ = (p / base).string() + ".jsn";
31 
32  return std::make_pair(currentFileName_, currentFileName_);
33  }
34 
36  std::string json_tmp_ = currentJsonName_ + ".open";
37  std::string transferDest = "";
38  std::string mergeType = "ROOT";
39  auto pt = dqmfilesaver::fillJson(runNumber_, sequence_, currentFileName_, transferDest, mergeType, nullptr);
40  write_json(json_tmp_, pt);
41  rename(json_tmp_.c_str(), currentJsonName_.c_str());
42  }
43 
46  TimeoutPoolOutputModule::fillDescription(desc);
47 
48  desc.setComment(
49  "Almost same as TimeoutPoolOutputModule, but the output files names "
50  "follow the FFF naming convention. Additionally a json 'description' "
51  "file is emitted for every .root file written.");
52 
53  desc.addUntracked<uint32_t>("runNumber", 0)
54  ->setComment(
55  "The run number, only used for file prefix: "
56  "'run000001_lumi0000_...'.");
57 
58  desc.addUntracked<std::string>("outputPath", "./")
59  ->setComment(
60  "Output path for the root and json files, usually the run "
61  "directory.");
62 
63  desc.addUntracked<std::string>("streamLabel", "streamEvDOutput")->setComment("Stream label, used for file suffix.");
64 
65  descriptions.add("jsonWriting", desc);
66  }
67 
68 } // namespace dqmservices
69 
ConfigurationDescriptions.h
dqmservices::JsonWritingTimeoutPoolOutputModule::JsonWritingTimeoutPoolOutputModule
JsonWritingTimeoutPoolOutputModule(edm::ParameterSet const &ps)
Definition: JsonWritingTimeoutPoolOutputModule.cc:13
dqmservices
Definition: DQMFileIterator.cc:18
dqmservices::JsonWritingTimeoutPoolOutputModule::outputPath_
std::string outputPath_
Definition: JsonWritingTimeoutPoolOutputModule.h:26
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
dqmservices::JsonWritingTimeoutPoolOutputModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: JsonWritingTimeoutPoolOutputModule.cc:44
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
fillJson.h
JsonWritingTimeoutPoolOutputModule.h
dqmservices::JsonWritingTimeoutPoolOutputModule::physicalAndLogicalNameForNewFile
std::pair< std::string, std::string > physicalAndLogicalNameForNewFile() override
Definition: JsonWritingTimeoutPoolOutputModule.cc:22
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
rename
Definition: rename.py:1
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
dqm-mbProfile.format
format
Definition: dqm-mbProfile.py:16
dqmservices::JsonWritingTimeoutPoolOutputModule::currentJsonName_
std::string currentJsonName_
Definition: JsonWritingTimeoutPoolOutputModule.h:29
str
#define str(s)
Definition: TestProcessor.cc:48
dqmservices::JsonWritingTimeoutPoolOutputModule::doExtrasAfterCloseFile
void doExtrasAfterCloseFile() override
Definition: JsonWritingTimeoutPoolOutputModule.cc:35
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
OutputModuleBase
dqmfilesaver::fillJson
boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string &transferDestinationStr, const std::string &mergeTypeStr, evf::FastMonitoringService *fms)
Definition: fillJson.cc:29
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::ParameterSet
Definition: ParameterSet.h:36
edm::ParameterSetDescription::setComment
void setComment(std::string const &value)
Definition: ParameterSetDescription.cc:33
dqmservices::JsonWritingTimeoutPoolOutputModule::currentFileName_
std::string currentFileName_
Definition: JsonWritingTimeoutPoolOutputModule.h:28
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
dqmservices::JsonWritingTimeoutPoolOutputModule
Definition: JsonWritingTimeoutPoolOutputModule.h:11
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
dqmservices::JsonWritingTimeoutPoolOutputModule::streamLabel_
std::string streamLabel_
Definition: JsonWritingTimeoutPoolOutputModule.h:25
dqmservices::JsonWritingTimeoutPoolOutputModule::runNumber_
uint32_t runNumber_
Definition: JsonWritingTimeoutPoolOutputModule.h:24
dqmservices::JsonWritingTimeoutPoolOutputModule::sequence_
uint32_t sequence_
Definition: JsonWritingTimeoutPoolOutputModule.h:23