53 class TreeHelperBase {
55 TreeHelperBase() : m_wasFilled(
false), m_firstIndex(0), m_lastIndex(0) {}
56 virtual ~TreeHelperBase() {}
64 bool wasFilled()
const {
return m_wasFilled; }
65 void getRangeAndReset(ULong64_t& iFirstIndex, ULong64_t& iLastIndex) {
66 iFirstIndex = m_firstIndex;
67 iLastIndex = m_lastIndex;
69 m_firstIndex = m_lastIndex + 1;
70 m_lastIndex = m_firstIndex;
76 ULong64_t m_firstIndex;
77 ULong64_t m_lastIndex;
81 class TreeHelper :
public TreeHelperBase {
83 TreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
84 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr) {
91 assert(
nullptr != m_bufferPtr);
101 m_bufferPtr =
nullptr;
102 m_tree->Branch(
kValueBranch, &m_bufferPtr, 128 * 1024, 0);
105 uint32_t m_flagBuffer;
110 class IntTreeHelper :
public TreeHelperBase {
112 IntTreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
113 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr) {
131 uint32_t m_flagBuffer;
136 class FloatTreeHelper :
public TreeHelperBase {
138 FloatTreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
139 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr) {
157 uint32_t m_flagBuffer;
162 class StringTreeHelper :
public TreeHelperBase {
164 StringTreeHelper(TTree* iTree,
std::string* iFullNameBufferPtr)
165 : m_tree(iTree), m_flagBuffer(0), m_fullNameBufferPtr(iFullNameBufferPtr), m_bufferPtr(&m_buffer) {
183 uint32_t m_flagBuffer;
192 class ModuleCallingContext;
242 switch (iTypeIndex) {
244 return new IntTreeHelper(iTree, iFullNameBufferPtr);
246 return new FloatTreeHelper(iTree, iFullNameBufferPtr);
248 return new StringTreeHelper(iTree, iFullNameBufferPtr);
250 return new TreeHelper<TH1F>(iTree, iFullNameBufferPtr);
252 return new TreeHelper<TH1S>(iTree, iFullNameBufferPtr);
254 return new TreeHelper<TH1D>(iTree, iFullNameBufferPtr);
256 return new TreeHelper<TH2F>(iTree, iFullNameBufferPtr);
258 return new TreeHelper<TH2S>(iTree, iFullNameBufferPtr);
260 return new TreeHelper<TH2D>(iTree, iFullNameBufferPtr);
262 return new TreeHelper<TH3F>(iTree, iFullNameBufferPtr);
264 return new TreeHelper<TProfile>(iTree, iFullNameBufferPtr);
266 return new TreeHelper<TProfile2D>(iTree, iFullNameBufferPtr);
282 m_fileName(
pset.getUntrackedParameter<
std::
string>(
"fileName")),
283 m_logicalFileName(
pset.getUntrackedParameter<
std::
string>(
"logicalFileName")),
285 m_treeHelpers(
kNIndicies,
std::shared_ptr<TreeHelperBase>()),
286 m_presentHistoryIndex(0),
287 m_filterOnRun(
pset.getUntrackedParameter<unsigned
int>(
"filterOnRun")),
288 m_fullNameBufferPtr(&m_fullNameBuffer),
289 m_indicesTree(nullptr) {
295 consumesMany<DQMToken, edm::InLumi>();
296 consumesMany<DQMToken, edm::InRun>();
340 "DQMRootOutputModule",
345 std::vector<std::string>());
396 for (std::vector<MonitorElement*>::iterator it =
items.begin(), itEnd =
items.end(); it != itEnd; ++it) {
397 assert((*it)->getScope() == MonitorElementData::Scope::LUMI);
398 std::map<unsigned int, unsigned int>::iterator itFound =
m_dqmKindToTypeIndex.find((
int)(*it)->kind());
414 bool storedLumiIndex =
false;
415 unsigned int typeIndex = 0;
419 if ((*it)->wasFilled()) {
422 storedLumiIndex =
true;
426 if (not storedLumiIndex) {
452 for (std::vector<MonitorElement*>::iterator it =
items.begin(), itEnd =
items.end(); it != itEnd; ++it) {
453 assert((*it)->getScope() == MonitorElementData::Scope::RUN);
454 std::map<unsigned int, unsigned int>::iterator itFound =
m_dqmKindToTypeIndex.find((
int)(*it)->kind());
470 unsigned int typeIndex = 0;
474 if ((*it)->wasFilled()) {
498 processHistoryTree->SetDirectory(metaDataDirectory);
500 unsigned int index = 0;
515 assert(
nullptr != history);
517 for (edm::ProcessHistory::collection_type::const_iterator itPC = history->
begin(), itPCEnd = history->
end();
521 releaseVersion = itPC->releaseVersion();
522 passID = itPC->passID();
523 parameterSetID = itPC->parameterSetID().compactForm();
524 processHistoryTree->Fill();
530 parameterSetsTree->SetDirectory(metaDataDirectory);
538 it->second.toString(blob);
539 parameterSetsTree->Fill();
563 desc.addUntracked<
unsigned int>(
"filterOnRun", 0)
564 ->setComment(
"Only write the run with this run number. 0 means write all runs.");
565 desc.addOptionalUntracked<
int>(
"splitLevel", 99)
566 ->setComment(
"UNUSED Only here to allow older configurations written for PoolOutputModule to work.");
567 const std::vector<std::string>
keep = {
"drop *",
"keep DQMToken_*_*_*"};
573 ->setComment(
"PSet is only used by Data Operations and not by this module.");