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

template<>
void addSignals (edm::Event &e)
 
void addSignals (edm::Event &e) override
 
 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.

90  : HiMixingWorkerBase(object, tags, label) {
91  ;
92  }

◆ ~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<>
void edm::HiMixingWorker< HepMCProduct >::addSignals ( edm::Event e)
virtual

Implements edm::HiMixingWorkerBase.

Definition at line 127 of file HiMixingModule.cc.

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  }

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

◆ addSignals() [2/2]

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

Implements edm::HiMixingWorkerBase.

Definition at line 94 of file HiMixingModule.cc.

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  }

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

edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::HiMixingWorkerBase::tags_
std::vector< InputTag > tags_
Definition: HiMixingModule.cc:82
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EncodedEventId
Definition: EncodedEventId.h:11
CrossingFrame
Definition: CrossingFrame.h:37
magneticfield::handles
std::vector< BaseVolumeHandle * > handles
Definition: BaseVolumeHandle.h:154
edm::HiMixingWorkerBase::label_
std::string label_
Definition: HiMixingModule.cc:83
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:675
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::HiMixingWorkerBase::HiMixingWorkerBase
HiMixingWorkerBase()
Definition: HiMixingModule.cc:71
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
edm::HepMCProduct
Definition: HepMCProduct.h:21
edm::HiMixingWorkerBase::object_
std::string object_
Definition: HiMixingModule.cc:81
label
const char * label
Definition: PFTauDecayModeTools.cc:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37