CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LuminosityBlockBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Common_LuminosityBlockBase_h
2 #define FWCore_Common_LuminosityBlockBase_h
3 
4 // -*- C++ -*-
5 //
6 // Package: FWCore/Common
7 // Class : LuminosityBlockBase
8 //
19 //
20 // Original Author: Eric Vaandering
21 // Created: Tue Jan 12 15:31:00 CDT 2010
22 //
23 
24 #if !defined(__CINT__) && !defined(__MAKECINT__)
25 
33 
34 //#include "FWCore/Framework/interface/PrincipalGetAdapter.h"
35 //#include "FWCore/Framework/interface/Frameworkfwd.h"
36 
37 namespace edm {
38 
40  public:
42  virtual ~LuminosityBlockBase();
43 
44  // AUX functions.
47  }
48 
49  RunNumber_t run() const {
50  return luminosityBlockAuxiliary().run();
51  }
52 
54  return luminosityBlockAuxiliary().id();
55  }
56 
57  Timestamp const& beginTime() const {
59  }
60  Timestamp const& endTime() const {
62  }
63 
65 
66 /* template<typename PROD>
67  bool
68  get(SelectorBase const&, Handle<PROD>& result) const;
69 
70  template<typename PROD>
71  bool
72  getByLabel(std::string const& label, Handle<PROD>& result) const;
73 
74  template<typename PROD>
75  bool
76  getByLabel(std::string const& label,
77  std::string const& productInstanceName,
78  Handle<PROD>& result) const;
79 */
81  template<typename PROD>
82  bool
83  getByLabel(InputTag const& tag, Handle<PROD>& result) const;
84 /*
85  template<typename PROD>
86  void
87  getMany(SelectorBase const&, std::vector<Handle<PROD> >& results) const;
88 
89  template<typename PROD>
90  bool
91  getByType(Handle<PROD>& result) const;
92 
93  template<typename PROD>
94  void
95  getManyByType(std::vector<Handle<PROD> >& results) const;
96 
97  Run const&
98  getRun() const {
99  return *run_;
100  }
101 
103  template<typename PROD>
104  void
105  put(std::auto_ptr<PROD> product) {put<PROD>(product, std::string());}
106 
108  template<typename PROD>
109  void
110  put(std::auto_ptr<PROD> product, std::string const& productInstanceName);
111 
112  Provenance
113  getProvenance(BranchID const& theID) const;
114 
115  void
116  getAllProvenance(std::vector<Provenance const*>& provenances) const;
117 
118  ProcessHistory const&
119  processHistory() const;
120 */
121  private:
122 /* LuminosityBlockPrincipal const&
123  luminosityBlockPrincipal() const;
124 
125  LuminosityBlockPrincipal&
126  luminosityBlockPrincipal();
127 
128  typedef std::vector<std::pair<EDProduct*, ConstBranchDescription const*> > ProductPtrVec;
129  ProductPtrVec& putProducts() {return putProducts_;}
130  ProductPtrVec const& putProducts() const {return putProducts_;}
131 
132  // commit_() is called to complete the transaction represented by
133  // this PrincipalGetAdapter. The friendships required seems gross, but any
134  // alternative is not great either. Putting it into the
135  // public interface is asking for trouble
136  friend class ConfigurableInputSource;
137  friend class InputSource;
138  friend class DaqSource;
139  friend class RawInputSource;
140  friend class EDFilter;
141  friend class EDProducer;
142 
143  void commit_();
144 
145  PrincipalGetAdapter provRecorder_;
146  ProductPtrVec putProducts_;
147  LuminosityBlockAuxiliary const& aux_;
148  boost::shared_ptr<Run const> const run_;
149 */
150  virtual BasicHandle getByLabelImpl(std::type_info const& iWrapperType, std::type_info const& iProductType, const InputTag& iTag) const = 0;
151 
152  };
153 /*
154  template<typename PROD>
155  void
156  LuminosityBlock::put(std::auto_ptr<PROD> product, std::string const& productInstanceName) {
157  if (product.get() == 0) { // null pointer is illegal
158  TypeID typeID(typeid(PROD));
159  principal_get_adapter_detail::throwOnPutOfNullProduct("LuminosityBlock", typeID, productInstanceName);
160  }
161 
162  // The following will call post_insert if T has such a function,
163  // and do nothing if T has no such function.
164  typename boost::mpl::if_c<detail::has_postinsert<PROD>::value,
165  DoPostInsert<PROD>,
166  DoNotPostInsert<PROD> >::type maybe_inserter;
167  maybe_inserter(product.get());
168 
169  ConstBranchDescription const& desc =
170  provRecorder_.getBranchDescription(TypeID(*product), productInstanceName);
171 
172  Wrapper<PROD> *wp(new Wrapper<PROD>(product));
173  WrapperHolder edp(wp, wp->getInterface());
174 
175  putProducts().push_back(std::make_pair(edp, &desc));
176 
177  // product.release(); // The object has been copied into the Wrapper.
178  // The old copy must be deleted, so we cannot release ownership.
179  }
180 
181  template<typename PROD>
182  bool
183  LuminosityBlock::get(SelectorBase const& sel, Handle<PROD>& result) const {
184  return provRecorder_.get(sel,result);
185  }
186 
187  template<typename PROD>
188  bool
189  LuminosityBlock::getByLabel(std::string const& label, Handle<PROD>& result) const {
190  return provRecorder_.getByLabel(label,result);
191  }
192 
193  template<typename PROD>
194  bool
195  LuminosityBlock::getByLabel(std::string const& label,
196  std::string const& productInstanceName,
197  Handle<PROD>& result) const {
198  return provRecorder_.getByLabel(label,productInstanceName,result);
199  }
200 
202  template<typename PROD>
203  bool
204  LuminosityBlock::getByLabel(InputTag const& tag, Handle<PROD>& result) const {
205  return provRecorder_.getByLabel(tag,result);
206  }
207 
208  template<typename PROD>
209  void
210  LuminosityBlock::getMany(SelectorBase const& sel, std::vector<Handle<PROD> >& results) const {
211  return provRecorder_.getMany(sel,results);
212  }
213 
214  template<typename PROD>
215  bool
216  LuminosityBlock::getByType(Handle<PROD>& result) const {
217  return provRecorder_.getByType(result);
218  }
219 
220  template<typename PROD>
221  void
222  LuminosityBlock::getManyByType(std::vector<Handle<PROD> >& results) const {
223  return provRecorder_.getManyByType(results);
224  }
225 */
226  template<class T>
227  bool
229  result.clear();
230  BasicHandle bh = this->getByLabelImpl(typeid(Wrapper<T>), typeid(T), tag);
231  convert_handle(bh, result); // throws on conversion error
232  if (bh.failedToGet()) {
233  return false;
234  }
235  return true;
236  }
237 
238 
239 }
240 #endif
241 #endif
LuminosityBlockID id() const
virtual edm::LuminosityBlockAuxiliary const & luminosityBlockAuxiliary() const =0
Timestamp const & beginTime() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
same as above, but using the InputTag class
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
virtual BasicHandle getByLabelImpl(std::type_info const &iWrapperType, std::type_info const &iProductType, const InputTag &iTag) const =0
LuminosityBlockNumber_t luminosityBlock() const
Timestamp const & endTime() const
tuple result
Definition: query.py:137
RunNumber_t run() const
Timestamp const & endTime() const
Timestamp const & beginTime() const
LuminosityBlockNumber_t luminosityBlock() const
bool failedToGet() const
Definition: BasicHandle.h:94
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
unsigned int RunNumber_t
Definition: EventRange.h:32
long double T
LuminosityBlockID const & id() const