CMS 3D CMS Logo

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

91 : HiMixingWorkerBase(object,tags, label) {;}
tuple tags
Definition: o2o.py:248
template<class T >
edm::HiMixingWorker< T >::~HiMixingWorker ( )
inline

Definition at line 92 of file HiMixingModule.cc.

92 {;}

Member Function Documentation

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

Implements edm::HiMixingWorkerBase.

Definition at line 93 of file HiMixingModule.cc.

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

93  {
94  std::vector<Handle<std::vector<T> > > handles;
95  bool get = true;
96  for(size_t itag = 0; itag < tags_.size(); ++itag){
97  LogInfo("HiEmbedding")<<"itag "<<itag;
98  LogInfo("HiEmbedding")<<"label "<<tags_[itag].label();
99  LogInfo("HiEmbedding")<<"instance "<<tags_[itag].instance();
100  Handle<std::vector<T> > hand;
101  handles.push_back(hand);
102  get = get && e.getByLabel(tags_[itag],handles[itag]);
103  if(!get) LogWarning("Product inconsistency")<<"One of the sub-events is missing the product with type "
104  <<object_
105  <<", instance "
106  <<tags_[itag].instance()
107  <<" whereas the other one is fine.";
108  }
109 
110  if(get){
111  std::auto_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(crFrame,label_);
122  }
123  }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
std::vector< InputTag > tags_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
edm::EventID id() const
Definition: EventBase.h:60
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(), and edm::Event::put().

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