Go to the documentation of this file.00001
00002
00003 #if !defined(EventContainer_H)
00004 #define EventContainer_H
00005
00006 #include <map>
00007 #include <string>
00008 #include <typeinfo>
00009
00010 #include "TH1.h"
00011 #include "TFile.h"
00012
00013 #include "FWCore/Utilities/interface/InputTag.h"
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "PhysicsTools/FWLite/interface/CommandLineParser.h"
00016 #include "DataFormats/FWLite/interface/EventBase.h"
00017 #include "PhysicsTools/FWLite/interface/TH1Store.h"
00018
00019 namespace fwlite
00020 {
00021
00022 class EventContainer : public EventBase
00023 {
00024 public:
00025
00027
00029
00030 typedef std::map< std::string, std::string > SSMap;
00031 typedef void ( *FuncPtr ) (std::string&);
00032
00034
00036
00037 friend std::ostream& operator<< (std::ostream& o_stream,
00038 const EventContainer &rhs);
00039
00041
00042
00043
00044
00046
00048
00050 EventContainer (optutl::CommandLineParser &parser,
00051 FuncPtr funcPtr = 0);
00052 ~EventContainer();
00053
00055
00057
00058
00059 int eventsSeen () const { return m_eventsSeen; }
00060
00062
00064
00065
00066
00067 void add (TH1 *histPtr, const std::string &directory = "");
00068
00069
00070 TH1* hist (const std::string &name);
00071 TH1* hist (const char* name)
00072 { return hist( (const std::string) name); }
00073 TH1* hist (const TString &name)
00074 { return hist( (const char*) name ); }
00075
00076
00077 optutl::CommandLineParser &parser();
00078
00080
00082 bool getByLabel (const std::type_info& iInfo,
00083 const char* iModuleLabel,
00084 const char* iProductInstanceLabel,
00085 const char* iProcessLabel,
00086 void* oData) const;
00087
00088 const std::string getBranchNameFor (const std::type_info& iInfo,
00089 const char* iModuleLabel,
00090 const char* iProductInstanceLabel,
00091 const char* iProcessLabel) const;
00092
00093 const EventContainer& operator++();
00094
00095 const EventContainer& toBegin();
00096
00097 bool atEnd() const;
00098
00099
00100 edm::TriggerNames const& triggerNames(edm::TriggerResults const& triggerResults) const
00101 { return m_eventBasePtr->triggerNames(triggerResults); }
00102
00103 edm::TriggerResultsByName triggerResultsByName(std::string const& process) const
00104 { return m_eventBasePtr->triggerResultsByName(process); }
00105
00106 Long64_t fileIndex() const
00107 { return m_eventBasePtr->fileIndex(); }
00108 Long64_t secondaryFileIndex() const
00109 { return m_eventBasePtr->secondaryFileIndex(); }
00110
00111 edm::EventAuxiliary const& eventAuxiliary() const
00112 { return m_eventBasePtr->eventAuxiliary(); }
00113
00114 template <class T>
00115 bool getByLabel (const edm::InputTag &tag,
00116 edm::Handle<T> &handle) const
00117 { return m_eventBasePtr->getByLabel (tag, handle); }
00119
00121
00122
00123 private:
00124
00126
00128
00129
00130 EventContainer (const EventContainer &rhs) {}
00131
00133
00135
00136 fwlite::EventBase *m_eventBasePtr;
00137 TH1Store m_histStore;
00138 std::string m_outputName;
00139 int m_eventsSeen;
00140 int m_maxWanted;
00141 int m_outputEvery;
00142 optutl::CommandLineParser *m_parserPtr;
00143
00145
00147
00148 static bool sm_autoloaderCalled;
00149
00150 };
00151 }
00152
00153
00154 #endif // EventContainer_H