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

88  : HiMixingWorkerBase(object, tags, label) {
89  ;
90  }

◆ ~HiMixingWorker()

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

Definition at line 91 of file HiMixingModule.cc.

91 { ; }

Member Function Documentation

◆ addSignals() [1/2]

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

Implements edm::HiMixingWorkerBase.

Definition at line 125 of file HiMixingModule.cc.

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  }

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

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  }

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

edm::LogInfo
Definition: MessageLogger.h:254
edm::HiMixingWorkerBase::tags_
std::vector< InputTag > tags_
Definition: HiMixingModule.cc:80
edm::Handle
Definition: AssociativeIterator.h:50
EncodedEventId
Definition: EncodedEventId.h:11
CrossingFrame
Definition: CrossingFrame.h:38
magneticfield::handles
std::vector< BaseVolumeHandle * > handles
Definition: BaseVolumeHandle.h:154
edm::LogWarning
Definition: MessageLogger.h:141
edm::HiMixingWorkerBase::label_
std::string label_
Definition: HiMixingModule.cc:81
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:669
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:69
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
edm::HepMCProduct
Definition: HepMCProduct.h:18
edm::HiMixingWorkerBase::object_
std::string object_
Definition: HiMixingModule.cc:79
label
const char * label
Definition: PFTauDecayModeTools.cc:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37