23 #include <boost/filesystem.hpp>
54 class TreeHelperBase {
56 TreeHelperBase() : m_wasFilled(
false), m_firstIndex(0), m_lastIndex(0) {}
57 virtual ~TreeHelperBase() {}
65 bool wasFilled()
const {
return m_wasFilled; }
66 void getRangeAndReset(ULong64_t& iFirstIndex, ULong64_t& iLastIndex) {
67 iFirstIndex = m_firstIndex;
68 iLastIndex = m_lastIndex;
70 m_firstIndex = m_lastIndex + 1;
71 m_lastIndex = m_firstIndex;
77 ULong64_t m_firstIndex;
78 ULong64_t m_lastIndex;
82 class TreeHelper :
public TreeHelperBase {
84 TreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
85 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr) {
92 assert(
nullptr != m_bufferPtr);
102 m_bufferPtr =
nullptr;
103 m_tree->Branch(
kValueBranch, &m_bufferPtr, 128 * 1024, 0);
106 uint32_t m_flagBuffer;
111 class IntTreeHelper :
public TreeHelperBase {
113 IntTreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
114 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr) {
132 uint32_t m_flagBuffer;
137 class FloatTreeHelper :
public TreeHelperBase {
139 FloatTreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
140 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr) {
158 uint32_t m_flagBuffer;
163 class StringTreeHelper :
public TreeHelperBase {
165 StringTreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
166 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr), m_bufferPtr(&m_buffer) {
184 uint32_t m_flagBuffer;
193 class ModuleCallingContext;
243 switch (iTypeIndex) {
245 return new IntTreeHelper(iTree, iFullNameBufferPtr);
247 return new FloatTreeHelper(iTree, iFullNameBufferPtr);
249 return new StringTreeHelper(iTree, iFullNameBufferPtr);
251 return new TreeHelper<TH1F>(iTree, iFullNameBufferPtr);
253 return new TreeHelper<TH1S>(iTree, iFullNameBufferPtr);
255 return new TreeHelper<TH1D>(iTree, iFullNameBufferPtr);
257 return new TreeHelper<TH2F>(iTree, iFullNameBufferPtr);
259 return new TreeHelper<TH2S>(iTree, iFullNameBufferPtr);
261 return new TreeHelper<TH2D>(iTree, iFullNameBufferPtr);
263 return new TreeHelper<TH3F>(iTree, iFullNameBufferPtr);
265 return new TreeHelper<TProfile>(iTree, iFullNameBufferPtr);
267 return new TreeHelper<TProfile2D>(iTree, iFullNameBufferPtr);
283 m_fileName(
pset.getUntrackedParameter<
std::
string>(
"fileName")),
284 m_logicalFileName(
pset.getUntrackedParameter<
std::
string>(
"logicalFileName")),
286 m_treeHelpers(
kNIndicies,
std::shared_ptr<TreeHelperBase>()),
287 m_presentHistoryIndex(0),
288 m_filterOnRun(
pset.getUntrackedParameter<unsigned
int>(
"filterOnRun")),
289 m_fullNameBufferPtr(&m_fullNameBuffer),
290 m_indicesTree(nullptr) {
296 consumesMany<DQMToken, edm::InLumi>();
297 consumesMany<DQMToken, edm::InRun>();
341 "DQMRootOutputModule",
346 std::vector<std::string>());
397 for (std::vector<MonitorElement*>::iterator it =
items.begin(), itEnd =
items.end(); it != itEnd; ++it) {
398 assert((*it)->getScope() == MonitorElementData::Scope::LUMI);
399 std::map<unsigned int, unsigned int>::iterator itFound =
m_dqmKindToTypeIndex.find((
int)(*it)->kind());
415 bool storedLumiIndex =
false;
416 unsigned int typeIndex = 0;
420 if ((*it)->wasFilled()) {
423 storedLumiIndex =
true;
427 if (not storedLumiIndex) {
453 for (std::vector<MonitorElement*>::iterator it =
items.begin(), itEnd =
items.end(); it != itEnd; ++it) {
454 assert((*it)->getScope() == MonitorElementData::Scope::RUN);
455 std::map<unsigned int, unsigned int>::iterator itFound =
m_dqmKindToTypeIndex.find((
int)(*it)->kind());
471 unsigned int typeIndex = 0;
475 if ((*it)->wasFilled()) {
499 processHistoryTree->SetDirectory(metaDataDirectory);
501 unsigned int index = 0;
516 assert(
nullptr != history);
518 for (edm::ProcessHistory::collection_type::const_iterator itPC = history->
begin(), itPCEnd = history->
end();
522 releaseVersion = itPC->releaseVersion();
523 passID = itPC->passID();
524 parameterSetID = itPC->parameterSetID().compactForm();
525 processHistoryTree->Fill();
531 parameterSetsTree->SetDirectory(metaDataDirectory);
539 it->second.toString(blob);
540 parameterSetsTree->Fill();
564 desc.addUntracked<
unsigned int>(
"filterOnRun", 0)
565 ->setComment(
"Only write the run with this run number. 0 means write all runs.");
566 desc.addOptionalUntracked<
int>(
"splitLevel", 99)
567 ->setComment(
"UNUSED Only here to allow older configurations written for PoolOutputModule to work.");
568 const std::vector<std::string>
keep = {
"drop *",
"keep DQMToken_*_*_*"};
574 ->setComment(
"PSet is only used by Data Operations and not by this module.");