CMS 3D CMS Logo

Public Member Functions

edm::HiMixingWorker< T > Class Template Reference

Inheritance diagram for edm::HiMixingWorker< T >:
edm::HiMixingWorkerBase

List of all members.

Public Member Functions

void addSignals (edm::Event &e)
template<>
void addSignals (edm::Event &e)
 HiMixingWorker (std::string &object, std::vector< InputTag > &tags, std::string &label)
 ~HiMixingWorker ()

Detailed Description

template<class T>
class edm::HiMixingWorker< T >

Definition at line 90 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 92 of file HiMixingModule.cc.

: HiMixingWorkerBase(object,tags, label) {;}
template<class T >
edm::HiMixingWorker< T >::~HiMixingWorker ( ) [inline]

Definition at line 93 of file HiMixingModule.cc.

{;}

Member Function Documentation

template<class T >
void edm::HiMixingWorker< T >::addSignals ( edm::Event e) [inline, virtual]

Implements edm::HiMixingWorkerBase.

Definition at line 94 of file HiMixingModule.cc.

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

                                  {
         std::vector<Handle<std::vector<T> > > handles;
         bool get = true;
         for(size_t itag = 0; itag < tags_.size(); ++itag){
            std::cout<<"itag "<<itag<<std::endl;
            std::cout<<"label "<<tags_[itag].label()<<std::endl;
            std::cout<<"instance "<<tags_[itag].instance()<<std::endl;
            Handle<std::vector<T> > hand;
            handles.push_back(hand);
            get = get && e.getByLabel(tags_[itag],handles[itag]);
            if(!get)  LogError("Product inconsistency")<<"One of the sub-events is missing the product with type "
                                                       <<object_
                                                       <<", instance "
                                                       <<tags_[itag].instance()
                                                       <<" whereas the other one is fine.";
         }
         
         if(get){
            std::auto_ptr<CrossingFrame<T> > crFrame(new CrossingFrame<T>() );      
            crFrame->addSignals(handles[0].product(),e.id());
            for(size_t itag = 1; itag < tags_.size(); ++itag){
               crFrame->addPileups(0,const_cast< std::vector<T> * >(handles[itag].product()),itag);      
            }
            e.put(crFrame,label_);
         }
      }
template<>
void edm::HiMixingWorker< HepMCProduct >::addSignals ( edm::Event e) [virtual]

Implements edm::HiMixingWorkerBase.

Definition at line 123 of file HiMixingModule.cc.

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

                                                        {

   std::vector<Handle<HepMCProduct> > handles;
   bool get = true;
   for(size_t itag = 0; itag< tags_.size(); ++itag){
      Handle<HepMCProduct> hand;
      handles.push_back(hand);
      get = get && e.getByLabel(tags_[itag],handles[itag]);
      if(!get)  LogError("Product inconsistency")<<"One of the sub-events is missing the product with type "
                                                 <<object_
                                                 <<", instance "
                                                 <<tags_[itag].instance()
                                                 <<" whereas the other one is fine.";
   }
   
   if(get){
      std::auto_ptr<CrossingFrame<HepMCProduct> > crFrame(new CrossingFrame<HepMCProduct>() );
      crFrame->addSignals(handles[0].product(),e.id());
      for(size_t itag = 1; itag < tags_.size(); ++itag){
         crFrame->addPileups(0, const_cast<HepMCProduct *>(handles[itag].product()),itag);
      }
      e.put(crFrame,label_);
   }
}