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 87 of file HiMixingModule.cc.

Constructor & Destructor Documentation

◆ HiMixingWorker()

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.

◆ ~HiMixingWorker()

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

Definition at line 93 of file HiMixingModule.cc.

93 { ; }

Member Function Documentation

◆ addSignals() [1/2]

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

Implements edm::HiMixingWorkerBase.

Definition at line 94 of file HiMixingModule.cc.

References MillePedeFileConverter_cfg::e, l1ctLayer2EG_cff::id, B2GTnPMonitor_cfi::item, and eostools::move().

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  }
std::vector< BaseVolumeHandle * > handles
std::vector< InputTag > tags_
Log< level::Info, false > LogInfo
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511

◆ addSignals() [2/2]

template<>
void edm::HiMixingWorker< HepMCProduct >::addSignals ( edm::Event e)
virtual

Implements edm::HiMixingWorkerBase.

Definition at line 127 of file HiMixingModule.cc.

References MillePedeFileConverter_cfg::e, and eostools::move().

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  }
std::vector< BaseVolumeHandle * > handles
std::vector< InputTag > tags_
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511