CMS 3D CMS Logo

MasterCollectionHelper.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_MasterCollectionHelper_h
2 #define CommonTools_UtilAlgos_MasterCollectionHelper_h
3 /* \class helper::MasterCollection<C>
4  *
5  * differentiate index addressing in case of edm::View
6  * since a View retrieving a collection of reference
7  * would have referece indices (key()) pointing to the master
8  * collection different from reference position into the view
9  *
10  * \author Luca Lista, INFN
11  *
12  * \version $Id: MasterCollectionHelper.h,v 1.1 2009/03/03 13:07:26 llista Exp $
13  *
14  */
19 
20 namespace helper {
21  template <typename C1>
25  size_t size() const { return handle_->size(); }
26  size_t index(size_t i) const { return i; }
27  const edm::Handle<C1>& get() const { return handle_; }
28  ref_type getRef(size_t idx) const { return ref_type(get(), idx); }
29  template <typename R>
30  R getConcreteRef(size_t idx) const {
31  return getRef(idx);
32  }
33 
34  private:
36  };
37 
38  template <typename T>
39  struct MasterCollection<edm::View<T> > {
42  if (!handle_->empty()) {
43  ref_ = edm::makeRefToBaseProdFrom(handle_->refAt(0), event);
44  }
45  }
46  size_t size() const {
47  if (ref_.isNull())
48  return 0;
49  return ref_->size();
50  }
51  size_t index(size_t i) const { return handle_->refAt(i).key(); }
52  const edm::RefToBaseProd<T>& get() const { return ref_; }
53  ref_type getRef(size_t idx) const { return ref_type(get(), idx); }
54  template <typename R>
55  R getConcreteRef(size_t idx) const {
56  return getRef(idx).template castTo<R>();
57  }
58 
59  private:
62  };
63 
64 } // namespace helper
65 
66 #endif
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
helper::MasterCollection::get
const edm::Handle< C1 > & get() const
Definition: MasterCollectionHelper.h:27
helper::MasterCollection
Definition: MasterCollectionHelper.h:22
helper::MasterCollection::getRef
ref_type getRef(size_t idx) const
Definition: MasterCollectionHelper.h:28
sistrip::View
View
Definition: ConstantsForView.h:26
patZpeak.handle
handle
Definition: patZpeak.py:23
edm
HLT enums.
Definition: AlignableModifier.h:19
helper::MasterCollection< edm::View< T > >::getConcreteRef
R getConcreteRef(size_t idx) const
Definition: MasterCollectionHelper.h:55
helper::MasterCollection::MasterCollection
MasterCollection(const edm::Handle< C1 > &handle, edm::Event const &event)
Definition: MasterCollectionHelper.h:24
helper::MasterCollection< edm::View< T > >::MasterCollection
MasterCollection(const edm::Handle< edm::View< T > > &handle, edm::Event const &event)
Definition: MasterCollectionHelper.h:41
helper::MasterCollection< edm::View< T > >::ref_type
edm::RefToBase< T > ref_type
Definition: MasterCollectionHelper.h:40
helper::MasterCollection< edm::View< T > >::ref_
edm::RefToBaseProd< T > ref_
Definition: MasterCollectionHelper.h:61
edm::Handle< C1 >
training_settings.idx
idx
Definition: training_settings.py:16
edm::Ref
Definition: AssociativeIterator.h:58
helper::MasterCollection< edm::View< T > >::getRef
ref_type getRef(size_t idx) const
Definition: MasterCollectionHelper.h:53
helper::MasterCollection::size
size_t size() const
Definition: MasterCollectionHelper.h:25
RefToBaseProd.h
edm::View
Definition: CaloClusterFwd.h:14
edm::makeRefToBaseProdFrom
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
Definition: makeRefToBaseProdFrom.h:34
helper::MasterCollection::handle_
edm::Handle< C1 > handle_
Definition: MasterCollectionHelper.h:35
helper
Definition: helper.py:1
helper::MasterCollection< edm::View< T > >::handle_
edm::Handle< edm::View< T > > handle_
Definition: MasterCollectionHelper.h:60
makeRefToBaseProdFrom.h
helper::MasterCollection::index
size_t index(size_t i) const
Definition: MasterCollectionHelper.h:26
helper::MasterCollection::ref_type
edm::Ref< C1 > ref_type
Definition: MasterCollectionHelper.h:23
helper::MasterCollection< edm::View< T > >::size
size_t size() const
Definition: MasterCollectionHelper.h:46
edm::RefToBase
Definition: AssociativeIterator.h:54
View.h
event
Definition: event.py:1
helper::MasterCollection< edm::View< T > >::get
const edm::RefToBaseProd< T > & get() const
Definition: MasterCollectionHelper.h:52
edm::Event
Definition: Event.h:73
event
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
dttmaxenums::R
Definition: DTTMax.h:29
helper::MasterCollection::getConcreteRef
R getConcreteRef(size_t idx) const
Definition: MasterCollectionHelper.h:30
helper::MasterCollection< edm::View< T > >::index
size_t index(size_t i) const
Definition: MasterCollectionHelper.h:51
edm::RefToBaseProd
Definition: RefToBase.h:65