CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EventContainer.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 #if !defined(EventContainer_H)
4 #define EventContainer_H
5 
6 #include <map>
7 #include <string>
8 #include <typeinfo>
9 
10 #include "TH1.h"
11 #include "TFile.h"
12 
18 
19 namespace fwlite {
20 
21  class EventContainer : public EventBase {
22  public:
24  // Public Constants //
26 
27  typedef std::map<std::string, std::string> SSMap;
28  typedef void (*FuncPtr)(std::string&);
29 
31  // friends //
33  // tells particle data how to print itself out
34  friend std::ostream& operator<<(std::ostream& o_stream, const EventContainer& rhs);
35 
37  // _ //
38  // |\/| |_ //
39  // | |EMBER | UNCTIONS //
40  // //
42 
44  // Constructors and Destructor //
47  ~EventContainer() override;
48 
50  // One Liners //
52 
53  // return number of events seen
54  int eventsSeen() const { return m_eventsSeen; }
55 
57  // Regular Member Functions //
59 
60  // adds a histogram pointer to the map. You can specify a
61  // directory as well if you wish.
62  void add(TH1* histPtr, const std::string& directory = "");
63 
64  // given a string, returns corresponding histogram pointer
65  TH1* hist(const std::string& name);
66  TH1* hist(const char* name) { return hist((const std::string)name); }
67  TH1* hist(const TString& name) { return hist((const char*)name); }
68 
69  // return this containers parser
71 
73  // Implement the two functions needed to make this an EventBase. //
75  bool getByLabel(const std::type_info& iInfo,
76  const char* iModuleLabel,
77  const char* iProductInstanceLabel,
78  const char* iProcessLabel,
79  void* oData) const override;
80 
81  const std::string getBranchNameFor(const std::type_info& iInfo,
82  const char* iModuleLabel,
83  const char* iProductInstanceLabel,
84  const char* iProcessLabel) const override;
85 
86  const EventContainer& operator++() override;
87 
88  const EventContainer& toBegin() override;
89 
90  bool atEnd() const override;
91 
93  return m_eventBasePtr->triggerNames(triggerResults);
94  }
95 
97  return m_eventBasePtr->triggerResultsByName(triggerResults);
98  }
99 
100  Long64_t fileIndex() const override { return m_eventBasePtr->fileIndex(); }
101  Long64_t secondaryFileIndex() const override { return m_eventBasePtr->secondaryFileIndex(); }
102 
103  edm::EventAuxiliary const& eventAuxiliary() const override { return m_eventBasePtr->eventAuxiliary(); }
104 
105  template <class T>
107  return m_eventBasePtr->getByLabel(tag, handle);
108  }
110  // Static Member Functions //
112 
113  private:
115  // Private Member Functions //
117 
118  // stop the copy constructor
120 
122  // Private Member Data //
124 
132 
134  // Private Static Member Data //
136 
137  static bool sm_autoloaderCalled;
138  };
139 } // namespace fwlite
140 
141 #endif // EventContainer_H
virtual edm::EventAuxiliary const & eventAuxiliary() const =0
virtual Long64_t fileIndex() const
Definition: EventBase.h:56
EventContainer(optutl::CommandLineParser &parser, FuncPtr funcPtr=nullptr)
virtual Long64_t secondaryFileIndex() const
Definition: EventBase.h:57
const EventContainer & operator++() override
Long64_t fileIndex() const override
void(* FuncPtr)(std::string &)
TH1 * hist(const TString &name)
EventContainer(const EventContainer &rhs)
const EventContainer & toBegin() override
static bool sm_autoloaderCalled
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const =0
std::map< std::string, std::string > SSMap
fwlite::EventBase * m_eventBasePtr
edm::EventAuxiliary const & eventAuxiliary() const override
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
bool atEnd() const override
tuple handle
Definition: patZpeak.py:23
void add(TH1 *histPtr, const std::string &directory="")
bool getByLabel(const std::type_info &iInfo, const char *iModuleLabel, const char *iProductInstanceLabel, const char *iProcessLabel, void *oData) const override
static std::string const triggerResults
Definition: EdmProvDump.cc:44
Long64_t secondaryFileIndex() const override
virtual TriggerResultsByName triggerResultsByName(edm::TriggerResults const &triggerResults) const =0
optutl::CommandLineParser * m_parserPtr
edm::TriggerResultsByName triggerResultsByName(edm::TriggerResults const &triggerResults) const override
virtual TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const =0
bool getByLabel(const edm::InputTag &tag, edm::Handle< T > &handle) const
const std::string getBranchNameFor(const std::type_info &iInfo, const char *iModuleLabel, const char *iProductInstanceLabel, const char *iProcessLabel) const override
TH1 * hist(const char *name)
TH1 * hist(const std::string &name)
friend std::ostream & operator<<(std::ostream &o_stream, const EventContainer &rhs)
optutl::CommandLineParser & parser()