CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultiChainEvent.h
Go to the documentation of this file.
1 #ifndef DataFormats_FWLite_MultiChainEvent_h
2 #define DataFormats_FWLite_MultiChainEvent_h
3 // -*- C++ -*-
4 //
5 // Package: FWLite
6 // Class : MultiChainEvent
7 //
16 //
17 // Original Author: Salvatore Rappoccio
18 // Created: Thu Jul 9 22:05:56 CDT 2009
19 //
20 #if !defined(__CINT__) && !defined(__MAKECINT__)
21 // system include files
22 #include <string>
23 #include <typeinfo>
24 #include <vector>
25 #include "boost/shared_ptr.hpp"
26 
27 // user include files
30 
31 // forward declarations
32 namespace edm {
33  class WrapperHolder;
34  class ProductRegistry;
35  class ProcessHistory;
36  class BranchDescription;
37  class EDProductGetter;
38  class EventAux;
39  class TriggerResults;
40  class TriggerNames;
42 }
43 
44 namespace fwlite {
45 
46  namespace internal {
47  class MultiProductGetter;
48  }
49 
51 {
52 
53  public:
54 
55  typedef std::map<edm::EventID, Long64_t> sec_file_index_map;
56  typedef std::pair<edm::EventID, edm::EventID> event_id_range;
57  typedef std::map<event_id_range, Long64_t> sec_file_range_index_map;
58 
59  MultiChainEvent(std::vector<std::string> const& iFileNames1,
60  std::vector<std::string> const& iFileNames2,
61  bool useSecFileMapSorted = false);
62  virtual ~MultiChainEvent();
63 
64  const MultiChainEvent& operator++();
65 
67  bool to(Long64_t iIndex);
68 
69  //If lumi is non-zero, Go to event by Run, Lumi, and Event number
70  //If lumi is zero, Go to event by Run and Event number
71  bool to(edm::EventID id);
74 
75  // Go to the very first Event.
76  const MultiChainEvent& toBegin();
77 
78  // ---------- const member functions ---------------------
79  virtual std::string const getBranchNameFor(std::type_info const&,
80  char const*,
81  char const*,
82  char const*) const;
83 
85  virtual bool getByLabel(std::type_info const&, char const*, char const*, char const*, void*) const;
86  virtual bool getByLabel(std::type_info const&, char const*, char const*, char const*, edm::WrapperHolder&) const;
87  //void getByBranchName(std::type_info const&, char const*, void*&) const;
88 
89  bool isValid() const;
90  operator bool() const;
91  bool atEnd() const;
92 
93  Long64_t size() const;
94 
95  virtual edm::EventAuxiliary const& eventAuxiliary() const;
96 
97  std::vector<edm::BranchDescription> const& getBranchDescriptions() const;
98  std::vector<std::string> const& getProcessHistory() const;
99  edm::ProcessHistory const& processHistory() const;
100  TFile* getTFile() const {
101  return event1_->getTFile();
102  }
103  TFile* getTFileSec() const {
104  return event2_->getTFile();
105  }
106 
107  Long64_t eventIndex() const { return event1_->eventIndex(); }
108  Long64_t eventIndexSec() const { return event2_->eventIndex(); }
109 
111  return event1_->getLuminosityBlock();
112  }
113 
114  fwlite::Run const& getRun() {
115  return event1_->getRun();
116  }
117 
118 
119  virtual Long64_t fileIndex() const
120  { return event1_->eventIndex(); }
121  virtual Long64_t secondaryFileIndex() const
122  { return event2_->eventIndex(); }
123 
125  virtual edm::TriggerResultsByName triggerResultsByName(std::string const& process) const;
126 
127  // ---------- static member functions --------------------
128  static void throwProductNotFoundException(std::type_info const&, char const*, char const*, char const*);
129 
130  // return the two chain events
131  ChainEvent const* primary () const { return &*event1_;}
132  ChainEvent const* secondary() const { return &*event2_;}
133 
134  // ---------- member functions ---------------------------
135 
137 
138 
139  private:
140 
141  MultiChainEvent(Event const&); // stop default
142 
143  const MultiChainEvent& operator= (Event const&); // stop default
144 
146  bool toSec(Long64_t iIndex);
147 
148  //Go to event from secondary files by Run, Lumi (if non-zero), and Event number
149  bool toSec(const edm::EventID &id);
152 
153 
154  // ---------- member data --------------------------------
155 
156  boost::shared_ptr<ChainEvent> event1_; // primary files
157  boost::shared_ptr<ChainEvent> event2_; // secondary files
158  boost::shared_ptr<internal::MultiProductGetter> getter_;
159 
160  // speed up secondary file access with a (run range)_1 ---> index_2 map,
161  // when the files are sorted by run,event within the file.
162  // in this case, it is sufficient to store only a run-range to index mapping.
163  // with this, the solution becomes more performant.
166 };
167 
168 }
169 #endif /*__CINT__ */
170 #endif
TFile * getTFileSec() const
edm::WrapperHolder getByProductID(edm::ProductID const &) const
std::vector< edm::BranchDescription > const & getBranchDescriptions() const
Long64_t eventIndexSec() const
unsigned int EventNumber_t
Definition: EventID.h:30
tuple lumi
Definition: fjr2json.py:35
boost::shared_ptr< ChainEvent > event2_
ChainEvent const * secondary() const
const MultiChainEvent & operator++()
fwlite::Run const & getRun()
ChainEvent const * primary() const
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
bool to(Long64_t iIndex)
Go to the event at index iIndex.
virtual Long64_t secondaryFileIndex() const
const MultiChainEvent & toBegin()
Long64_t size() const
bool toSec(Long64_t iIndex)
Go to the event from secondary files at index iIndex.
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
edm::ProcessHistory const & processHistory() const
std::map< edm::EventID, Long64_t > sec_file_index_map
std::vector< std::string > const & getProcessHistory() const
virtual Long64_t fileIndex() const
boost::shared_ptr< ChainEvent > event1_
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
boost::shared_ptr< internal::MultiProductGetter > getter_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::map< event_id_range, Long64_t > sec_file_range_index_map
sec_file_range_index_map secFileMapSorted_
virtual std::string const getBranchNameFor(std::type_info const &, char const *, char const *, char const *) const
virtual edm::EventAuxiliary const & eventAuxiliary() const
MultiChainEvent(std::vector< std::string > const &iFileNames1, std::vector< std::string > const &iFileNames2, bool useSecFileMapSorted=false)
std::pair< edm::EventID, edm::EventID > event_id_range
virtual edm::TriggerResultsByName triggerResultsByName(std::string const &process) const
const MultiChainEvent & operator=(Event const &)
unsigned int RunNumber_t
Definition: EventRange.h:32
TFile * getTFile() const
Long64_t eventIndex() const
tuple process
Definition: LaserDQM_cfg.py:3
fwlite::LuminosityBlock const & getLuminosityBlock()
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const