CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::MixingWorker< T > Class Template Reference

#include <MixingWorker.h>

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

Public Member Functions

void addPileups (const EventPrincipal &ep, ModuleCallingContext const *, unsigned int eventNr) override
 
void addSignals (const edm::Event &e) override
 
bool checkSignal (const edm::Event &e) override
 
virtual void copyPCrossingFrame (const PCrossingFrame< T > *PCF)
 
void createnewEDProduct () override
 
 MixingWorker ()
 
 MixingWorker (int minBunch, int maxBunch, int bunchSpace, std::string subdet, std::string label, std::string labelCF, int maxNbSources, InputTag &tag, InputTag &tagCF, bool makePCrossingFrame=false)
 
 MixingWorker (int minBunch, int maxBunch, int bunchSpace, std::string subdet, std::string label, std::string labelCF, int maxNbSources, InputTag &tag, InputTag &tagCF, std::vector< InputTag > const &tags)
 
void put (edm::Event &e) override
 
void reload (const edm::EventSetup &setup) override
 
void setBcrOffset () override
 
void setSourceOffset (const unsigned int s) override
 
void setTof () override
 
 ~MixingWorker () override
 
- Public Member Functions inherited from edm::MixingWorkerBase
 MixingWorkerBase ()
 
virtual ~MixingWorkerBase ()
 

Private Attributes

std::vector< InputTagallTags_
 
int bunchSpace_
 
std::unique_ptr< CrossingFrame< T > > crFrame_
 
std::string const label_
 
std::string const labelCF_
 
bool const makePCrossingFrame_
 
int maxBunch_
 
unsigned int const maxNbSources_
 
int minBunch_
 
std::string const subdet_
 
InputTag tag_
 
InputTag tagSignal_
 

Detailed Description

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

Definition at line 41 of file MixingWorker.h.

Constructor & Destructor Documentation

template<class T >
edm::MixingWorker< T >::MixingWorker ( )
inlineexplicit

standard constructor

Definition at line 46 of file MixingWorker.h.

46  :
47  minBunch_(-5),
48  maxBunch_(3),
49  bunchSpace_(75),
50  subdet_(std::string(" ")),
51  label_(std::string(" ")),
52  labelCF_(std::string(" ")),
53  maxNbSources_(5),
54  makePCrossingFrame_(false),
55  tag_(),
56  tagSignal_(),
57  allTags_(),
58  crFrame_(nullptr)
59  {
60  }
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
bool const makePCrossingFrame_
Definition: MixingWorker.h:177
std::string const labelCF_
Definition: MixingWorker.h:175
std::vector< InputTag > allTags_
Definition: MixingWorker.h:180
std::string const label_
Definition: MixingWorker.h:174
std::string const subdet_
Definition: MixingWorker.h:173
unsigned int const maxNbSources_
Definition: MixingWorker.h:176
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  makePCrossingFrame = false 
)
inline

Definition at line 63 of file MixingWorker.h.

66  :
70  bunchSpace_(bunchSpace),
71  subdet_(subdet),
72  label_(label),
73  labelCF_(labelCF),
74  maxNbSources_(maxNbSources),
75  makePCrossingFrame_(makePCrossingFrame),
76  tag_(tag),
77  tagSignal_(tagCF),
78  allTags_(),
79  crFrame_(nullptr)
80  {
81  }
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
bool const makePCrossingFrame_
Definition: MixingWorker.h:177
std::string const labelCF_
Definition: MixingWorker.h:175
char const * label
std::vector< InputTag > allTags_
Definition: MixingWorker.h:180
std::string const label_
Definition: MixingWorker.h:174
std::string const subdet_
Definition: MixingWorker.h:173
unsigned int const maxNbSources_
Definition: MixingWorker.h:176
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,
std::vector< InputTag > const &  tags 
)
inline

Definition at line 84 of file MixingWorker.h.

88  :
92  bunchSpace_(bunchSpace),
93  subdet_(subdet),
94  label_(label),
95  labelCF_(labelCF),
96  maxNbSources_(maxNbSources),
97  makePCrossingFrame_(false),
98  tag_(tag),
99  tagSignal_(tagCF),
100  allTags_(tags),
101  crFrame_(nullptr)
102  {
103  }
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
bool const makePCrossingFrame_
Definition: MixingWorker.h:177
std::string const labelCF_
Definition: MixingWorker.h:175
char const * label
std::vector< InputTag > allTags_
Definition: MixingWorker.h:180
std::string const label_
Definition: MixingWorker.h:174
std::string const subdet_
Definition: MixingWorker.h:173
unsigned int const maxNbSources_
Definition: MixingWorker.h:176
template<class T >
edm::MixingWorker< T >::~MixingWorker ( )
inlineoverride

Default destructor

Definition at line 106 of file MixingWorker.h.

106 {;}

Member Function Documentation

template<typename T >
void MixingWorker::addPileups ( const EventPrincipal ep,
ModuleCallingContext const *  mcc,
unsigned int  eventNr 
)
overridevirtual

Implements edm::MixingWorkerBase.

Definition at line 186 of file MixingWorker.h.

References edm::MixingWorker< T >::crFrame_, LogDebug, and edm::MixingWorker< T >::tag_.

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

186  {
187  std::shared_ptr<Wrapper<std::vector<T> > const> shPtr = getProductByTag<std::vector<T> >(ep, tag_, mcc);
188  if (shPtr) {
189  LogDebug("MixingModule") << shPtr->product()->size() << " pileup objects added, eventNr " << eventNr;
190  crFrame_->setPileupPtr(shPtr);
191  crFrame_->addPileups(*shPtr->product());
192  }
193  }
#define LogDebug(id)
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
template<class T >
void edm::MixingWorker< T >::addSignals ( const edm::Event e)
inlineoverridevirtual

Implements edm::MixingWorkerBase.

Definition at line 139 of file MixingWorker.h.

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

139  {
140  edm::Handle<std::vector<T> > result_t;
141  bool got = e.getByLabel(tag_,result_t);
142  if (got) {
143  LogDebug("MixingModule") <<" adding " << result_t.product()->size()<<" signal objects for "<<typeid(T).name()<<" with "<<tag_;
144  crFrame_->addSignals(result_t.product(),e.id());
145  } else {
146  LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for "<<typeid(T).name()<<", with "<<tag_;
147  }
148  }
#define LogDebug(id)
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:59
long double T
template<class T >
bool edm::MixingWorker< T >::checkSignal ( const edm::Event e)
inlineoverridevirtual

Steps in BMixingModule::produce

Implements edm::MixingWorkerBase.

Definition at line 120 of file MixingWorker.h.

References edm::InputTag::encode(), edm::Event::getByLabel(), edm::InputTag::instance(), edm::InputTag::label(), dataset::name, protons_cff::t, and edm::MixingWorker< T >::tag_.

120  {
121  bool got;
122  InputTag t;
123  edm::Handle<std::vector<T> > result_t;
124  got = e.getByLabel(tag_,result_t);
125  t = InputTag(tag_.label(),tag_.instance());
126 
127  if (got)
128  LogInfo("MixingModule") <<" Will create a CrossingFrame for "<< typeid(T).name()
129  << " with InputTag= "<< t.encode();
130 
131  return got;
132  }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
std::string const & label() const
Definition: InputTag.h:36
long double T
std::string const & instance() const
Definition: InputTag.h:37
template<class T >
void MixingWorker::copyPCrossingFrame ( const PCrossingFrame< T > *  PCF)
virtual

Definition at line 203 of file MixingWorker.h.

References edm::MixingWorker< T >::crFrame_, PCrossingFrame< T >::getBunchRange(), PCrossingFrame< T >::getBunchSpace(), PCrossingFrame< T >::getIdFirstPileup(), PCrossingFrame< T >::getMaxNbSources(), PCrossingFrame< T >::getPileupFileNr(), PCrossingFrame< T >::getPileupOffsetsBcr(), PCrossingFrame< T >::getPileupOffsetsSource(), PCrossingFrame< T >::getPileups(), and PCrossingFrame< T >::getSubDet().

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

204  {
205  crFrame_->setBunchRange(PCF->getBunchRange());
206  crFrame_->setBunchSpace(PCF->getBunchSpace());
207  crFrame_->setMaxNbSources(PCF->getMaxNbSources());
208  crFrame_->setSubDet(PCF->getSubDet());
209  crFrame_->setPileupOffsetsBcr(PCF->getPileupOffsetsBcr());
210  crFrame_->setPileupOffsetsSource(PCF->getPileupOffsetsSource());
211  crFrame_->setPileups(PCF->getPileups());
212 
213  // For playback option
214  crFrame_->setPileupFileNr(PCF->getPileupFileNr());
215  crFrame_->setIdFirstPileup(PCF->getIdFirstPileup());
216  }
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
int getBunchSpace() const
unsigned int getPileupFileNr() const
std::vector< const T * > getPileups() const
edm::EventID getIdFirstPileup() const
std::string getSubDet() const
unsigned int getMaxNbSources() const
std::pair< int, int > getBunchRange() const
const std::vector< unsigned int > & getPileupOffsetsBcr() const
template<class T >
void edm::MixingWorker< T >::createnewEDProduct ( )
inlineoverridevirtual
template<class T >
void edm::MixingWorker< T >::put ( edm::Event e)
inlineoverridevirtual

Implements edm::MixingWorkerBase.

Definition at line 157 of file MixingWorker.h.

References edm::MixingWorker< T >::copyPCrossingFrame(), edm::MixingWorker< T >::crFrame_, edm::MixingWorker< T >::label_, LogDebug, edm::MixingWorker< T >::makePCrossingFrame_, eostools::move(), dataset::name, and edm::Event::put().

157  {
158  if(makePCrossingFrame_) {
159  e.put(std::make_unique<PCrossingFrame<T> >(*crFrame_), label_);
160  }
162  LogDebug("MixingModule") <<" CF was put for type "<<typeid(T).name()<<" with "<<label_;
163  }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
bool const makePCrossingFrame_
Definition: MixingWorker.h:177
std::string const label_
Definition: MixingWorker.h:174
long double T
def move(src, dest)
Definition: eostools.py:511
template<class T >
void edm::MixingWorker< T >::reload ( const edm::EventSetup setup)
inlineoverridevirtual

Reimplemented from edm::MixingWorkerBase.

Definition at line 110 of file MixingWorker.h.

References MixingModuleConfig::bunchSpace(), edm::MixingWorker< T >::bunchSpace_, looper::config, edm::EventSetup::get(), MixingModuleConfig::maxBunch(), edm::MixingWorker< T >::maxBunch_, MixingModuleConfig::minBunch(), and edm::MixingWorker< T >::minBunch_.

110  {
111  //get the required parameters from DB.
112  // watch the label/tag
114  setup.get<MixingRcd>().get(config);
115  minBunch_=config->minBunch();
116  maxBunch_=config->maxBunch();
117  bunchSpace_=config->bunchSpace();
118  }
const int & bunchSpace() const
const int & maxBunch() const
config
Definition: looper.py:291
T get() const
Definition: EventSetup.h:71
const int & minBunch() const
template<class T >
void edm::MixingWorker< T >::setBcrOffset ( )
inlineoverridevirtual

Implements edm::MixingWorkerBase.

Definition at line 152 of file MixingWorker.h.

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

152 {crFrame_->setBcrOffset();}
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
template<class T >
void edm::MixingWorker< T >::setSourceOffset ( const unsigned int  s)
inlineoverridevirtual

Implements edm::MixingWorkerBase.

Definition at line 153 of file MixingWorker.h.

References edm::MixingWorker< T >::crFrame_, and edm::MixingWorker< T >::setTof().

153 {crFrame_->setSourceOffset(s);}
std::unique_ptr< CrossingFrame< T > > crFrame_
Definition: MixingWorker.h:182
template<class T >
void MixingWorker::setTof ( )
overridevirtual

Implements edm::MixingWorkerBase.

Definition at line 200 of file MixingWorker.h.

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

200 {;}

Member Data Documentation

template<class T >
std::vector<InputTag> edm::MixingWorker< T >::allTags_
private

Definition at line 180 of file MixingWorker.h.

template<class T >
int edm::MixingWorker< T >::bunchSpace_
private
template<class T >
std::unique_ptr<CrossingFrame<T> > edm::MixingWorker< T >::crFrame_
private
template<class T >
std::string const edm::MixingWorker< T >::label_
private
template<class T >
std::string const edm::MixingWorker< T >::labelCF_
private

Definition at line 175 of file MixingWorker.h.

template<class T >
bool const edm::MixingWorker< T >::makePCrossingFrame_
private

Definition at line 177 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 176 of file MixingWorker.h.

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

template<class T >
int edm::MixingWorker< T >::minBunch_
private
template<class T >
std::string const edm::MixingWorker< T >::subdet_
private

Definition at line 173 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

Definition at line 179 of file MixingWorker.h.