CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PileUpEventPrincipal.h
Go to the documentation of this file.
1 #ifndef SimGeneral_MixingModule_PileUpEventPrincipal_h
2 #define SimGeneral_MixingModule_PileUpEventPrincipal_h
3 
4 #include <set>
5 #include <string>
6 
14 class PCaloHit;
15 class PSimHit;
16 class SimTrack;
17 class SimVertex;
18 
20 public:
21 
22  PileUpEventPrincipal(edm::EventPrincipal const& ep, int bcr, int bsp, int eventId, int vtxOffset) :
23  principal_(ep), bunchCrossing_(bcr), bunchCrossingXbunchSpace_(bcr*bsp), id_(bcr, eventId), vertexOffset_(vtxOffset), labels_() {}
24 
25  bool
26  addLabel(edm::TypeID const& type, std::string const& label) const {
27  return true;
28  //return labels_.insert(std::make_pair(type, label)).second;
29  }
30 
32  return principal_;
33  }
34 
35  edm::EventPrincipal const& principal() const {
36  return principal_;
37  }
38 
39  int bunchCrossing() const {
40  return bunchCrossing_;
41  }
42 
43  template<typename T>
44  void
45  adjust(T& item) const {
46  }
47 
48  template<typename T>
49  bool
51  typedef typename T::value_type ItemType;
52  typedef typename T::iterator iterator;
54  convert_handle(bh, result);
55  if(result.isValid() && addLabel(edm::TypeID(typeid(T)), tag.label())) {
56  T& product = const_cast<T&>(*result.product());
57  for(iterator i = product.begin(), iEnd = product.end(); i != iEnd; ++i) {
58  adjust<ItemType>(*i);
59  }
60  }
61  return result.isValid();
62  }
63 
64 private:
70  mutable std::set<std::pair<edm::TypeID, std::string> > labels_;
71 };
72 
73 template<>
74 void PileUpEventPrincipal::adjust<PCaloHit>(PCaloHit& item) const;
75 
76 template<>
77 void PileUpEventPrincipal::adjust<PSimHit>(PSimHit& item) const;
78 
79 template<>
80 void PileUpEventPrincipal::adjust<SimTrack>(SimTrack& item) const;
81 
82 template<>
83 void PileUpEventPrincipal::adjust<SimVertex>(SimVertex& item) const;
84 #endif
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
PileUpEventPrincipal(edm::EventPrincipal const &ep, int bcr, int bsp, int eventId, int vtxOffset)
bool addLabel(edm::TypeID const &type, std::string const &label) const
std::set< std::pair< edm::TypeID, std::string > > labels_
edm::EventPrincipal const & principal()
edm::EventPrincipal const & principal_
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag) const
Definition: Principal.cc:421
tuple result
Definition: query.py:137
edm::EventPrincipal const & principal() const
bool isValid() const
Definition: HandleBase.h:76
Container::value_type value_type
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:42
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
void adjust(T &item) const
long double T