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

90 : HiMixingWorkerBase(object,tags, label) {;}
char const * label
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(), 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) LogWarning("Product inconsistency")<<"One of the sub-events is missing the product with type "
103  <<object_
104  <<", instance "
105  <<tags_[itag].instance()
106  <<" whereas the other one is fine.";
107  }
108 
109  if(get){
110  std::unique_ptr<CrossingFrame<T> > crFrame(new CrossingFrame<T>() );
111  crFrame->addSignals(handles[0].product(),e.id());
112  for(size_t itag = 1; itag < tags_.size(); ++itag){
113  std::vector<T>* product = const_cast<std::vector<T>*>(handles[itag].product());
114  EncodedEventId id(0,itag);
115  for(auto& item : *product) {
116  item.setEventId(id);
117  }
118  crFrame->addPileups(*product);
119  }
120  e.put(std::move(crFrame),label_);
121  }
122  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
std::vector< InputTag > tags_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
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 126 of file HiMixingModule.cc.

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

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