CMS 3D CMS Logo

List of all members | Public Member Functions
edm::HiMixingWorker< T > Class Template Reference
Inheritance diagram for edm::HiMixingWorker< T >:
edm::HiMixingWorkerBase

Public Member Functions

void addSignals (edm::Event &e) override
 
template<>
void addSignals (edm::Event &e)
 
 HiMixingWorker (std::string &object, std::vector< InputTag > &tags, std::string &label)
 
 ~HiMixingWorker () override
 
- Public Member Functions inherited from edm::HiMixingWorkerBase
 HiMixingWorkerBase ()
 
 HiMixingWorkerBase (std::string &object, std::vector< InputTag > &tags, std::string &label)
 
virtual ~HiMixingWorkerBase ()
 

Additional Inherited Members

- Public Attributes inherited from edm::HiMixingWorkerBase
std::string label_
 
std::string object_
 
std::vector< InputTagtags_
 

Detailed Description

template<class T>
class edm::HiMixingWorker< T >

Definition at line 85 of file HiMixingModule.cc.

Constructor & Destructor Documentation

template<class T >
edm::HiMixingWorker< T >::HiMixingWorker ( std::string &  object,
std::vector< InputTag > &  tags,
std::string &  label 
)
inline

Definition at line 87 of file HiMixingModule.cc.

template<class T >
edm::HiMixingWorker< T >::~HiMixingWorker ( )
inlineoverride

Definition at line 91 of file HiMixingModule.cc.

91 { ; }

Member Function Documentation

template<class T >
void edm::HiMixingWorker< T >::addSignals ( edm::Event e)
inlineoverridevirtual

Implements edm::HiMixingWorkerBase.

Definition at line 92 of file HiMixingModule.cc.

References edm::Event::getByLabel(), triggerObjects_cff::id, edm::EventBase::id(), B2GTnPMonitor_cfi::item, eostools::move(), and edm::Event::put().

92  {
93  std::vector<Handle<std::vector<T> > > handles;
94  bool get = true;
95  for (size_t itag = 0; itag < tags_.size(); ++itag) {
96  LogInfo("HiEmbedding") << "itag " << itag;
97  LogInfo("HiEmbedding") << "label " << tags_[itag].label();
98  LogInfo("HiEmbedding") << "instance " << tags_[itag].instance();
99  Handle<std::vector<T> > hand;
100  handles.push_back(hand);
101  get = get && e.getByLabel(tags_[itag], handles[itag]);
102  if (!get)
103  LogWarning("Product inconsistency")
104  << "One of the sub-events is missing the product with type " << object_ << ", instance "
105  << tags_[itag].instance() << " whereas the other one is fine.";
106  }
107 
108  if (get) {
109  std::unique_ptr<CrossingFrame<T> > crFrame(new CrossingFrame<T>());
110  crFrame->addSignals(handles[0].product(), e.id());
111  for (size_t itag = 1; itag < tags_.size(); ++itag) {
112  std::vector<T>* product = const_cast<std::vector<T>*>(handles[itag].product());
113  EncodedEventId id(0, itag);
114  for (auto& item : *product) {
115  item.setEventId(id);
116  }
117  crFrame->addPileups(*product);
118  }
119  e.put(std::move(crFrame), label_);
120  }
121  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< BaseVolumeHandle * > handles
std::vector< InputTag > tags_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
edm::EventID id() const
Definition: EventBase.h:59
def move(src, dest)
Definition: eostools.py:511
template<>
void edm::HiMixingWorker< HepMCProduct >::addSignals ( edm::Event e)
virtual

Implements edm::HiMixingWorkerBase.

Definition at line 125 of file HiMixingModule.cc.

References edm::Event::getByLabel(), edm::EventBase::id(), eostools::move(), and edm::Event::put().

125  {
126  std::vector<Handle<HepMCProduct> > handles;
127  bool get = true;
128  for (size_t itag = 0; itag < tags_.size(); ++itag) {
130  handles.push_back(hand);
131  get = get && e.getByLabel(tags_[itag], handles[itag]);
132  if (!get)
133  LogWarning("Product inconsistency")
134  << "One of the sub-events is missing the product with type " << object_ << ", instance "
135  << tags_[itag].instance() << " whereas the other one is fine.";
136  }
137 
138  if (get) {
139  std::unique_ptr<CrossingFrame<HepMCProduct> > crFrame(new CrossingFrame<HepMCProduct>());
140  crFrame->addSignals(handles[0].product(), e.id());
141  for (size_t itag = 1; itag < tags_.size(); ++itag) {
142  HepMCProduct* product = const_cast<HepMCProduct*>(handles[itag].product());
143  crFrame->addPileups(*product);
144  }
145  e.put(std::move(crFrame), label_);
146  }
147  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< BaseVolumeHandle * > handles
std::vector< InputTag > tags_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
edm::EventID id() const
Definition: EventBase.h:59
def move(src, dest)
Definition: eostools.py:511