19 #include <boost/shared_ptr.hpp>
45 class TreeHelperBase {
47 TreeHelperBase(): m_wasFilled(
false), m_firstIndex(0),m_lastIndex(0) {}
48 virtual ~TreeHelperBase(){}
51 if(m_wasFilled) {++m_lastIndex;}
53 bool wasFilled()
const {
return m_wasFilled;}
54 void getRangeAndReset(ULong64_t& iFirstIndex, ULong64_t& iLastIndex) {
55 iFirstIndex = m_firstIndex;
56 iLastIndex = m_lastIndex;
58 m_firstIndex = m_lastIndex +1;
59 m_lastIndex = m_firstIndex;
64 ULong64_t m_firstIndex;
65 ULong64_t m_lastIndex;
69 class TreeHelper :
public TreeHelperBase {
71 TreeHelper(TTree* iTree, std::string* iFullNameBufferPtr ):
72 m_tree(iTree), m_flagBuffer(0),m_fullNameBufferPtr(iFullNameBufferPtr){
setup();}
75 m_flagBuffer = iElement->
getTag();
77 assert(0!=m_bufferPtr);
92 uint32_t m_flagBuffer;
93 std::string* m_fullNameBufferPtr;
97 class IntTreeHelper:
public TreeHelperBase {
99 IntTreeHelper(TTree* iTree, std::string* iFullNameBufferPtr):
100 m_tree(iTree), m_flagBuffer(0),m_fullNameBufferPtr(iFullNameBufferPtr)
105 m_flagBuffer = iElement->
getTag();
117 uint32_t m_flagBuffer;
118 std::string* m_fullNameBufferPtr;
122 class FloatTreeHelper:
public TreeHelperBase {
124 FloatTreeHelper(TTree* iTree, std::string* iFullNameBufferPtr):
125 m_tree(iTree), m_flagBuffer(0),m_fullNameBufferPtr(iFullNameBufferPtr)
129 m_flagBuffer = iElement->
getTag();
141 uint32_t m_flagBuffer;
142 std::string* m_fullNameBufferPtr;
146 class StringTreeHelper:
public TreeHelperBase {
148 StringTreeHelper(TTree* iTree, std::string* iFullNameBufferPtr):
149 m_tree(iTree), m_flagBuffer(0),m_fullNameBufferPtr(iFullNameBufferPtr), m_bufferPtr(&m_buffer)
153 m_flagBuffer = iElement->
getTag();
165 uint32_t m_flagBuffer;
166 std::string* m_fullNameBufferPtr;
167 std::string m_buffer;
168 std::string* m_bufferPtr;
219 static TreeHelperBase*
222 std::string* iFullNameBufferPtr) {
225 return new IntTreeHelper(iTree,iFullNameBufferPtr);
227 return new FloatTreeHelper(iTree,iFullNameBufferPtr);
229 return new StringTreeHelper(iTree,iFullNameBufferPtr);
231 return new TreeHelper<TH1F>(iTree,iFullNameBufferPtr);
233 return new TreeHelper<TH1S>(iTree,iFullNameBufferPtr);
235 return new TreeHelper<TH1D>(iTree,iFullNameBufferPtr);
237 return new TreeHelper<TH2F>(iTree,iFullNameBufferPtr);
239 return new TreeHelper<TH2S>(iTree,iFullNameBufferPtr);
241 return new TreeHelper<TH2D>(iTree,iFullNameBufferPtr);
243 return new TreeHelper<TH3F>(iTree,iFullNameBufferPtr);
245 return new TreeHelper<TProfile>(iTree,iFullNameBufferPtr);
247 return new TreeHelper<TProfile2D>(iTree,iFullNameBufferPtr);
261 edm::OutputModule(pset),
262 m_fileName(pset.getUntrackedParameter<std::string>(
"fileName")),
263 m_logicalFileName(pset.getUntrackedParameter<std::string>(
"logicalFileName",
"")),
265 m_treeHelpers(
kNIndicies,boost::shared_ptr<TreeHelperBase>()),
266 m_presentHistoryIndex(0),
267 m_filterOnRun(pset.getUntrackedParameter<unsigned int>(
"filterOnRun",0)),
268 m_fullNameBufferPtr(&m_fullNameBuffer),
300 return nullptr!=
m_file.get();
317 "DQMRootOutputModule",
319 m_file->GetUUID().AsString(),
322 std::vector<std::string>()
344 tree->SetDirectory(
m_file.get());
380 for(std::vector<MonitorElement*>::iterator it = items.begin(), itEnd=items.end();
383 if((*it)->getLumiFlag()) {
384 std::map<unsigned int,unsigned int>::iterator itFound =
m_dqmKindToTypeIndex.find((*it)->kind());
390 bool storedLumiIndex =
false;
391 unsigned int typeIndex = 0;
395 if((*it)->wasFilled()) {
398 storedLumiIndex =
true;
402 if(not storedLumiIndex) {
430 for(std::vector<MonitorElement*>::iterator it = items.begin(), itEnd=items.end();
433 if(not (*it)->getLumiFlag()) {
434 std::map<unsigned int,unsigned int>::iterator itFound =
m_dqmKindToTypeIndex.find((*it)->kind());
441 unsigned int typeIndex = 0;
445 if((*it)->wasFilled()) {
479 processHistoryTree->SetDirectory(metaDataDirectory);
481 unsigned int index = 0;
485 std::string parameterSetID;
487 std::string releaseVersion;
500 for(edm::ProcessHistory::collection_type::const_iterator itPC = history->
begin(), itPCEnd = history->
end();
503 processName = itPC->processName();
504 releaseVersion = itPC->releaseVersion();
505 passID = itPC->passID();
506 parameterSetID = itPC->parameterSetID().compactForm();
507 processHistoryTree->Fill();
513 parameterSetsTree->SetDirectory(metaDataDirectory);
523 it->second.toString(blob);
524 parameterSetsTree->Fill();
virtual bool isFileOpen() const
const_iterator begin() const
Token outputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &outputModuleClassName, std::string const &moduleLabel, std::string const &guid, std::string const &dataType, std::string const &branchHash, std::vector< std::string > const &branchNames)
virtual void write(edm::EventPrincipal const &e)
Timestamp const & beginTime() const
virtual void writeRun(edm::RunPrincipal const &)
virtual void openFile(edm::FileBlock const &)
#define DEFINE_FWK_MODULE(type)
Timestamp const & endTime() const
unsigned int m_presentHistoryIndex
boost::uint64_t value() const
static TreeHelperBase * makeHelper(unsigned int iTypeIndex, TTree *iTree, std::string *iFullNameBufferPtr)
std::string const & processName() const
static ThreadSafeRegistry * instance()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void outputFileClosed(Token fileToken)
const uint32_t getTag(void) const
std::vector< MonitorElement * > getAllContents(const std::string &path) const
std::string m_fullNameBuffer
virtual ~DQMRootOutputModule()
std::map< unsigned int, unsigned int > m_dqmKindToTypeIndex
bool getMapped(key_type const &k, value_type &result) const
void addDefault(ParameterSetDescription const &psetDescription)
const_iterator begin() const
virtual void finishEndFile()
ProcessHistoryID const & processHistoryID() const
Timestamp const & beginTime() const
std::auto_ptr< TFile > m_file
collection_type::const_iterator const_iterator
double getFloatValue(void) const
Timestamp const & endTime() const
const std::string getFullname(void) const
get full name of ME including Pathname
const std::string & getStringValue(void) const
DQMRootOutputModule(edm::ParameterSet const &pset)
TimeValue_t value() const
std::vector< boost::shared_ptr< TreeHelperBase > > m_treeHelpers
std::string * m_fullNameBufferPtr
virtual void startEndFile()
TObject * getRootObject(void) const
void reportLumiSection(unsigned int run, unsigned int lumiSectId)
int64_t getIntValue(void) const
std::string toString() const
unsigned int m_filterOnRun
const_iterator end() const
virtual void writeLuminosityBlock(edm::LuminosityBlockPrincipal const &)
edm::JobReport::Token m_jrToken
const_iterator end() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string m_logicalFileName
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
ModuleDescription const & description() const
virtual void beginRun(edm::RunPrincipal const &r)
LuminosityBlockID id() const
void reportRunNumber(unsigned int run)
std::vector< edm::ProcessHistoryID > m_seenHistories