CMS 3D CMS Logo

Public Member Functions | Private Attributes

edm::MixingWorker< T > Class Template Reference

#include <MixingWorker.h>

Inheritance diagram for edm::MixingWorker< T >:
edm::MixingWorkerBase

List of all members.

Public Member Functions

virtual void addPileups (const int bcr, const EventPrincipal &ep, unsigned int eventNr, int vertexoffset)
virtual void addSignals (const edm::Event &e)
virtual bool checkSignal (const edm::Event &e)
virtual void copyPCrossingFrame (const PCrossingFrame< T > *PCF)
virtual void createnewEDProduct ()
 MixingWorker ()
 MixingWorker (int minBunch, int maxBunch, int bunchSpace, std::string subdet, std::string label, std::string labelCF, int maxNbSources, InputTag &tag, InputTag &tagCF, bool mixProdStep2)
virtual void put (edm::Event &e)
virtual void reload (const edm::EventSetup &setup)
virtual void setBcrOffset ()
virtual void setSourceOffset (const unsigned int s)
void setTof ()
virtual ~MixingWorker ()

Private Attributes

int bunchSpace_
CrossingFrame< T > * crFrame_
std::string const label_
std::string const labelCF_
int maxBunch_
unsigned int const maxNbSources_
int minBunch_
bool mixProdStep2_
PCrossingFrame< T > * secSourceCF_
std::string const subdet_
InputTag tag_
InputTag tagSignal_

Detailed Description

template<class T>
class edm::MixingWorker< T >

Definition at line 40 of file MixingWorker.h.


Constructor & Destructor Documentation

template<class T >
edm::MixingWorker< T >::MixingWorker ( ) [inline, explicit]

standard constructor

Definition at line 45 of file MixingWorker.h.

References edm::MixingWorker< T >::tag_, and edm::MixingWorker< T >::tagSignal_.

                              :
        minBunch_(-5),
        maxBunch_(3),
        bunchSpace_(75),
        subdet_(std::string(" ")),
        label_(std::string(" ")),
        labelCF_(std::string(" ")),
        maxNbSources_(5),
        mixProdStep2_(false)
          {
            tag_=InputTag();
            tagSignal_=InputTag();
          }
template<class T >
edm::MixingWorker< T >::MixingWorker ( int  minBunch,
int  maxBunch,
int  bunchSpace,
std::string  subdet,
std::string  label,
std::string  labelCF,
int  maxNbSources,
InputTag tag,
InputTag tagCF,
bool  mixProdStep2 
) [inline]

Definition at line 60 of file MixingWorker.h.

References edm::MixingWorker< T >::mixProdStep2_.

                                                      :
        MixingWorkerBase(),
        minBunch_(minBunch),
        maxBunch_(maxBunch),
        bunchSpace_(bunchSpace),
        subdet_(subdet),
        label_(label),
        labelCF_(labelCF),
        maxNbSources_(maxNbSources),
        tag_(tag),
        tagSignal_(tagCF)
        {
          mixProdStep2_ = mixProdStep2;
        }
template<class T >
virtual edm::MixingWorker< T >::~MixingWorker ( ) [inline, virtual]

Default destructor

Definition at line 79 of file MixingWorker.h.

{;}

Member Function Documentation

template<class T >
void MixingWorker::addPileups ( const int  bcr,
const EventPrincipal ep,
unsigned int  eventNr,
int  vertexoffset 
) [virtual]

Implements edm::MixingWorkerBase.

Definition at line 184 of file MixingWorker.h.

References LogDebug.

    {
      if (!mixProdStep2_){
        // default version
        // valid for CaloHits 
        boost::shared_ptr<Wrapper<std::vector<T> > const> shPtr =
        edm::getProductByTag<std::vector<T> >(ep, tag_);

        if (shPtr) {
          LogDebug("MixingModule") <<shPtr->product()->size()<<"  pileup objects  added, eventNr "<<eventNr;
          crFrame_->setPileupPtr(shPtr);
          crFrame_->addPileups(bcr,const_cast< std::vector<T> * >(shPtr->product()),eventNr);
        }
        
      }
      else
      {
        boost::shared_ptr<Wrapper<PCrossingFrame<T> > const> shPtr = getProductByTag<PCrossingFrame<T> >(ep, tag_);
     
        if (shPtr){                     
          crFrame_->setPileupPtr(shPtr);
          secSourceCF_ = const_cast<PCrossingFrame<T> * >(shPtr->product());
          LogDebug("MixingModule") << "Add PCrossingFrame<T>  eventNr " << secSourceCF_->getEventID();

          copyPCrossingFrame(secSourceCF_);

        }
        else
          LogDebug("MixingModule") << "Could not get the PCrossingFrame<T>!";
      }
    }
template<class T >
virtual void edm::MixingWorker< T >::addSignals ( const edm::Event e) [inline, virtual]

Implements edm::MixingWorkerBase.

Definition at line 118 of file MixingWorker.h.

References edm::MixingWorker< T >::crFrame_, edm::Event::getByLabel(), edm::EventBase::id(), LogDebug, edm::MixingWorker< T >::mixProdStep2_, mergeVDriftHistosByStation::name, edm::Handle< T >::product(), edm::MixingWorker< T >::tag_, and edm::MixingWorker< T >::tagSignal_.

                                                {
        if (mixProdStep2_){       
          edm::Handle<std::vector<T> >  result_t;
          bool got = e.getByLabel(tagSignal_,result_t);
          if (got) {
            LogDebug("MixingModule") <<" adding " << result_t.product()->size()<<" signal objects for "<<typeid(T).name()<<" with "<<tagSignal_;
            crFrame_->addSignals(result_t.product(),e.id());
          }
          else    LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for "<<typeid(T).name()<<", with "<<tagSignal_;
        }
        else{
        // Default version
          edm::Handle<std::vector<T> >  result_t;
          bool got = e.getByLabel(tag_,result_t);
          if (got) {
            LogDebug("MixingModule") <<" adding " << result_t.product()->size()<<" signal objects for "<<typeid(T).name()<<" with "<<tag_;
            crFrame_->addSignals(result_t.product(),e.id());
          }
          else    LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for "<<typeid(T).name()<<", with "<<tag_;

        }
        
      }
template<class T >
virtual bool edm::MixingWorker< T >::checkSignal ( const edm::Event e) [inline, virtual]

Steps in BMixingModule::produce

Implements edm::MixingWorkerBase.

Definition at line 93 of file MixingWorker.h.

References edm::InputTag::encode(), edm::Event::getByLabel(), edm::InputTag::instance(), edm::InputTag::label(), edm::MixingWorker< T >::mixProdStep2_, mergeVDriftHistosByStation::name, lumiQTWidget::t, edm::MixingWorker< T >::tag_, and edm::MixingWorker< T >::tagSignal_.

                                                 {
          bool got;
          InputTag t;
          edm::Handle<std::vector<T> >  result_t;
          if (mixProdStep2_){   
             got = e.getByLabel(tagSignal_,result_t);
             t = InputTag(tagSignal_.label(),tagSignal_.instance());   
          }
          else{
             got = e.getByLabel(tag_,result_t);
             t = InputTag(tag_.label(),tag_.instance());
          }
          
          if (got)
               LogInfo("MixingModule") <<" Will create a CrossingFrame for "<< typeid(T).name() 
                                       << " with InputTag= "<< t.encode();
                                       
          return got;
      }
template<class T >
void MixingWorker::copyPCrossingFrame ( const PCrossingFrame< T > *  PCF) [virtual]
template<class T >
virtual void edm::MixingWorker< T >::createnewEDProduct ( ) [inline, virtual]
template<class T >
virtual void edm::MixingWorker< T >::put ( edm::Event e) [inline, virtual]

Implements edm::MixingWorkerBase.

Definition at line 149 of file MixingWorker.h.

References edm::MixingWorker< T >::crFrame_, edm::MixingWorker< T >::label_, edm::MixingWorker< T >::labelCF_, LogDebug, edm::MixingWorker< T >::mixProdStep2_, mergeVDriftHistosByStation::name, and edm::Event::put().

                                    {   
        std::auto_ptr<CrossingFrame<T> > pOut(crFrame_);
        if (!mixProdStep2_){
          e.put(pOut,label_);
          LogDebug("MixingModule") <<" CF was put for type "<<typeid(T).name()<<" with "<<label_;
        }
        else {
          e.put(pOut,labelCF_);
          LogDebug("MixingModule") <<" CF was put for type "<<typeid(T).name()<<" with "<<labelCF_;
        }
      }
template<class T >
virtual void edm::MixingWorker< T >::reload ( const edm::EventSetup setup) [inline, virtual]

Reimplemented from edm::MixingWorkerBase.

Definition at line 83 of file MixingWorker.h.

References edm::MixingWorker< T >::bunchSpace_, HDQMDatabaseProducer::config, edm::EventSetup::get(), edm::MixingWorker< T >::maxBunch_, and edm::MixingWorker< T >::minBunch_.

                                                      {
        //get the required parameters from DB.
        // watch the label/tag
        edm::ESHandle<MixingModuleConfig> config;
        setup.get<MixingRcd>().get(config);
        minBunch_=config->minBunch();
        maxBunch_=config->maxBunch();
        bunchSpace_=config->bunchSpace();
      }
template<class T >
virtual void edm::MixingWorker< T >::setBcrOffset ( ) [inline, virtual]

Implements edm::MixingWorkerBase.

Definition at line 144 of file MixingWorker.h.

References edm::MixingWorker< T >::crFrame_.

{crFrame_->setBcrOffset();}
template<class T >
virtual void edm::MixingWorker< T >::setSourceOffset ( const unsigned int  s) [inline, virtual]

Implements edm::MixingWorkerBase.

Definition at line 145 of file MixingWorker.h.

References edm::MixingWorker< T >::crFrame_.

{crFrame_->setSourceOffset(s);}
template<class T >
void MixingWorker::setTof ( ) [virtual]

Implements edm::MixingWorkerBase.

Definition at line 230 of file MixingWorker.h.

{;}

Member Data Documentation

template<class T >
int edm::MixingWorker< T >::bunchSpace_ [private]
template<class T >
CrossingFrame<T>* edm::MixingWorker< T >::crFrame_ [private]
template<class T >
std::string const edm::MixingWorker< T >::label_ [private]

Definition at line 171 of file MixingWorker.h.

Referenced by edm::MixingWorker< T >::put().

template<class T >
std::string const edm::MixingWorker< T >::labelCF_ [private]

Definition at line 172 of file MixingWorker.h.

Referenced by edm::MixingWorker< T >::put().

template<class T >
int edm::MixingWorker< T >::maxBunch_ [private]
template<class T >
unsigned int const edm::MixingWorker< T >::maxNbSources_ [private]

Definition at line 173 of file MixingWorker.h.

Referenced by edm::MixingWorker< T >::createnewEDProduct().

template<class T >
int edm::MixingWorker< T >::minBunch_ [private]
template<class T >
bool edm::MixingWorker< T >::mixProdStep2_ [private]
template<class T >
PCrossingFrame<T>* edm::MixingWorker< T >::secSourceCF_ [private]

Definition at line 179 of file MixingWorker.h.

template<class T >
std::string const edm::MixingWorker< T >::subdet_ [private]

Definition at line 170 of file MixingWorker.h.

Referenced by edm::MixingWorker< T >::createnewEDProduct().

template<class T >
InputTag edm::MixingWorker< T >::tag_ [private]
template<class T >
InputTag edm::MixingWorker< T >::tagSignal_ [private]