CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 87 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 89 of file HiMixingModule.cc.

90  : HiMixingWorkerBase(object, tags, label) {
91  ;
92  }
char const * label
template<class T >
edm::HiMixingWorker< T >::~HiMixingWorker ( )
inlineoverride

Definition at line 93 of file HiMixingModule.cc.

93 { ; }

Member Function Documentation

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

Implements edm::HiMixingWorkerBase.

Definition at line 94 of file HiMixingModule.cc.

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

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

Implements edm::HiMixingWorkerBase.

Definition at line 127 of file HiMixingModule.cc.

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

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