CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
22  class EventContainer : public EventBase
23  {
24  public:
25 
27  // Public Constants //
29 
30  typedef std::map< std::string, std::string > SSMap;
31  typedef void ( *FuncPtr ) (std::string&);
32 
34  // friends //
36  // tells particle data how to print itself out
37  friend std::ostream& operator<< (std::ostream& o_stream,
38  const EventContainer &rhs);
39 
41  // _ //
42  // |\/| |_ //
43  // | |EMBER | UNCTIONS //
44  // //
46 
48  // Constructors and Destructor //
51  FuncPtr funcPtr = 0);
53 
55  // One Liners //
57 
58  // return number of events seen
59  int eventsSeen () const { return m_eventsSeen; }
60 
62  // Regular Member Functions //
64 
65  // adds a histogram pointer to the map. You can specify a
66  // directory as well if you wish.
67  void add (TH1 *histPtr, const std::string &directory = "");
68 
69  // given a string, returns corresponding histogram pointer
70  TH1* hist (const std::string &name);
71  TH1* hist (const char* name)
72  { return hist( (const std::string) name); }
73  TH1* hist (const TString &name)
74  { return hist( (const char*) name ); }
75 
76  // return this containers parser
78 
80  // Implement the two functions needed to make this an EventBase. //
82  bool getByLabel (const std::type_info& iInfo,
83  const char* iModuleLabel,
84  const char* iProductInstanceLabel,
85  const char* iProcessLabel,
86  void* oData) const;
87 
88  const std::string getBranchNameFor (const std::type_info& iInfo,
89  const char* iModuleLabel,
90  const char* iProductInstanceLabel,
91  const char* iProcessLabel) const;
92 
93  const EventContainer& operator++();
94 
95  const EventContainer& toBegin();
96 
97  bool atEnd() const;
98 
99 
101  { return m_eventBasePtr->triggerNames(triggerResults); }
102 
104  { return m_eventBasePtr->triggerResultsByName(process); }
105 
106  Long64_t fileIndex() const
107  { return m_eventBasePtr->fileIndex(); }
108  Long64_t secondaryFileIndex() const
109  { return m_eventBasePtr->secondaryFileIndex(); }
110 
112  { return m_eventBasePtr->eventAuxiliary(); }
113 
114  template <class T>
115  bool getByLabel (const edm::InputTag &tag,
116  edm::Handle<T> &handle) const
117  { return m_eventBasePtr->getByLabel (tag, handle); }
119  // Static Member Functions //
121 
122 
123  private:
124 
126  // Private Member Functions //
128 
129  // stop the copy constructor
131 
133  // Private Member Data //
135 
143 
145  // Private Static Member Data //
147 
148  static bool sm_autoloaderCalled;
149 
150  };
151 }
152 
153 
154 #endif // EventContainer_H
virtual edm::EventAuxiliary const & eventAuxiliary() const =0
virtual Long64_t fileIndex() const
Definition: EventBase.h:67
Long64_t secondaryFileIndex() const
virtual Long64_t secondaryFileIndex() const
Definition: EventBase.h:68
const std::string getBranchNameFor(const std::type_info &iInfo, const char *iModuleLabel, const char *iProductInstanceLabel, const char *iProcessLabel) const
edm::EventAuxiliary const & eventAuxiliary() const
TH1 * hist(const TString &name)
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
EventContainer(const EventContainer &rhs)
EventContainer(optutl::CommandLineParser &parser, FuncPtr funcPtr=0)
static bool sm_autoloaderCalled
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const =0
Long64_t fileIndex() const
std::map< std::string, std::string > SSMap
fwlite::EventBase * m_eventBasePtr
bool getByLabel(const std::type_info &iInfo, const char *iModuleLabel, const char *iProductInstanceLabel, const char *iProcessLabel, void *oData) const
void(* FuncPtr)(std::string &)
virtual TriggerResultsByName triggerResultsByName(std::string const &process) const =0
edm::TriggerResultsByName triggerResultsByName(std::string const &process) const
tuple handle
Definition: patZpeak.py:22
void add(TH1 *histPtr, const std::string &directory="")
static std::string const triggerResults
Definition: EdmProvDump.cc:40
optutl::CommandLineParser * m_parserPtr
const EventContainer & toBegin()
virtual TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const =0
bool getByLabel(const edm::InputTag &tag, edm::Handle< T > &handle) const
TH1 * hist(const char *name)
TH1 * hist(const std::string &name)
tuple process
Definition: LaserDQM_cfg.py:3
friend std::ostream & operator<<(std::ostream &o_stream, const EventContainer &rhs)
optutl::CommandLineParser & parser()
const EventContainer & operator++()