CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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 ()
 
- Public Member Functions inherited from edm::MixingWorkerBase
 MixingWorkerBase ()
 
virtual ~MixingWorkerBase ()
 

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 ( )
inlineexplicit

standard constructor

Definition at line 45 of file MixingWorker.h.

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

45  :
46  minBunch_(-5),
47  maxBunch_(3),
48  bunchSpace_(75),
49  subdet_(std::string(" ")),
50  label_(std::string(" ")),
51  labelCF_(std::string(" ")),
52  maxNbSources_(5),
53  mixProdStep2_(false)
54  {
55  tag_=InputTag();
56  tagSignal_=InputTag();
57  }
std::string const labelCF_
Definition: MixingWorker.h:172
std::string const label_
Definition: MixingWorker.h:171
std::string const subdet_
Definition: MixingWorker.h:170
unsigned int const maxNbSources_
Definition: MixingWorker.h:173
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_.

63  :
65  minBunch_(minBunch),
66  maxBunch_(maxBunch),
67  bunchSpace_(bunchSpace),
68  subdet_(subdet),
69  label_(label),
70  labelCF_(labelCF),
71  maxNbSources_(maxNbSources),
72  tag_(tag),
73  tagSignal_(tagCF)
74  {
75  mixProdStep2_ = mixProdStep2;
76  }
std::string const labelCF_
Definition: MixingWorker.h:172
std::string const label_
Definition: MixingWorker.h:171
std::string const subdet_
Definition: MixingWorker.h:170
unsigned int const maxNbSources_
Definition: MixingWorker.h:173
template<class T >
virtual edm::MixingWorker< T >::~MixingWorker ( )
inlinevirtual

Default destructor

Definition at line 79 of file MixingWorker.h.

79 {;}

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.

185  {
186  if (!mixProdStep2_){
187  // default version
188  // valid for CaloHits
189  boost::shared_ptr<Wrapper<std::vector<T> > const> shPtr =
190  edm::getProductByTag<std::vector<T> >(ep, tag_);
191 
192  if (shPtr) {
193  LogDebug("MixingModule") <<shPtr->product()->size()<<" pileup objects added, eventNr "<<eventNr;
194  crFrame_->setPileupPtr(shPtr);
195  crFrame_->addPileups(bcr,const_cast< std::vector<T> * >(shPtr->product()),eventNr);
196  }
197 
198  }
199  else
200  {
201  boost::shared_ptr<Wrapper<PCrossingFrame<T> > const> shPtr = getProductByTag<PCrossingFrame<T> >(ep, tag_);
202 
203  if (shPtr){
204  crFrame_->setPileupPtr(shPtr);
205  secSourceCF_ = const_cast<PCrossingFrame<T> * >(shPtr->product());
206  LogDebug("MixingModule") << "Add PCrossingFrame<T> eventNr " << secSourceCF_->getEventID();
207 
209 
210  }
211  else
212  LogDebug("MixingModule") << "Could not get the PCrossingFrame<T>!";
213  }
214  }
#define LogDebug(id)
virtual void copyPCrossingFrame(const PCrossingFrame< T > *PCF)
Definition: MixingWorker.h:233
CrossingFrame< T > * crFrame_
Definition: MixingWorker.h:178
PCrossingFrame< T > * secSourceCF_
Definition: MixingWorker.h:179
template<class T >
virtual void edm::MixingWorker< T >::addSignals ( const edm::Event e)
inlinevirtual

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_.

118  {
119  if (mixProdStep2_){
120  edm::Handle<std::vector<T> > result_t;
121  bool got = e.getByLabel(tagSignal_,result_t);
122  if (got) {
123  LogDebug("MixingModule") <<" adding " << result_t.product()->size()<<" signal objects for "<<typeid(T).name()<<" with "<<tagSignal_;
124  crFrame_->addSignals(result_t.product(),e.id());
125  }
126  else LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for "<<typeid(T).name()<<", with "<<tagSignal_;
127  }
128  else{
129  // Default version
130  edm::Handle<std::vector<T> > result_t;
131  bool got = e.getByLabel(tag_,result_t);
132  if (got) {
133  LogDebug("MixingModule") <<" adding " << result_t.product()->size()<<" signal objects for "<<typeid(T).name()<<" with "<<tag_;
134  crFrame_->addSignals(result_t.product(),e.id());
135  }
136  else LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for "<<typeid(T).name()<<", with "<<tag_;
137 
138  }
139 
140  }
#define LogDebug(id)
CrossingFrame< T > * crFrame_
Definition: MixingWorker.h:178
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:56
long double T
template<class T >
virtual bool edm::MixingWorker< T >::checkSignal ( const edm::Event e)
inlinevirtual

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_.

93  {
94  bool got;
95  InputTag t;
96  edm::Handle<std::vector<T> > result_t;
97  if (mixProdStep2_){
98  got = e.getByLabel(tagSignal_,result_t);
99  t = InputTag(tagSignal_.label(),tagSignal_.instance());
100  }
101  else{
102  got = e.getByLabel(tag_,result_t);
103  t = InputTag(tag_.label(),tag_.instance());
104  }
105 
106  if (got)
107  LogInfo("MixingModule") <<" Will create a CrossingFrame for "<< typeid(T).name()
108  << " with InputTag= "<< t.encode();
109 
110  return got;
111  }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::string const & label() const
Definition: InputTag.h:25
long double T
std::string const & instance() const
Definition: InputTag.h:26
template<class T >
void MixingWorker::copyPCrossingFrame ( const PCrossingFrame< T > *  PCF)
virtual

Definition at line 233 of file MixingWorker.h.

References 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().

234  {
235  crFrame_->setBunchRange(PCF->getBunchRange());
236  crFrame_->setBunchSpace(PCF->getBunchSpace());
237  crFrame_->setMaxNbSources(PCF->getMaxNbSources());
238  crFrame_->setSubDet(PCF->getSubDet());
239  crFrame_->setPileupOffsetsBcr(PCF->getPileupOffsetsBcr());
240  crFrame_->setPileupOffsetsSource(PCF->getPileupOffsetsSource());
241  crFrame_->setPileups(PCF->getPileups());
242 
243  // For playback option
244  crFrame_->setPileupFileNr(PCF->getPileupFileNr());
245  crFrame_->setIdFirstPileup(PCF->getIdFirstPileup());
246  }
int getBunchSpace() const
unsigned int getPileupFileNr() const
edm::EventID getIdFirstPileup() const
CrossingFrame< T > * crFrame_
Definition: MixingWorker.h:178
std::string getSubDet() const
unsigned int getMaxNbSources() const
std::pair< int, int > getBunchRange() const
std::vector< unsigned int > getPileupOffsetsBcr() const
std::vector< const T * > getPileups() const
std::vector< std::vector< unsigned int > > getPileupOffsetsSource() const
template<class T >
virtual void edm::MixingWorker< T >::createnewEDProduct ( )
inlinevirtual
template<class T >
virtual void edm::MixingWorker< T >::put ( edm::Event e)
inlinevirtual

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().

149  {
150  std::auto_ptr<CrossingFrame<T> > pOut(crFrame_);
151  if (!mixProdStep2_){
152  e.put(pOut,label_);
153  LogDebug("MixingModule") <<" CF was put for type "<<typeid(T).name()<<" with "<<label_;
154  }
155  else {
156  e.put(pOut,labelCF_);
157  LogDebug("MixingModule") <<" CF was put for type "<<typeid(T).name()<<" with "<<labelCF_;
158  }
159  }
#define LogDebug(id)
std::string const labelCF_
Definition: MixingWorker.h:172
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
CrossingFrame< T > * crFrame_
Definition: MixingWorker.h:178
std::string const label_
Definition: MixingWorker.h:171
long double T
template<class T >
virtual void edm::MixingWorker< T >::reload ( const edm::EventSetup setup)
inlinevirtual

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_.

83  {
84  //get the required parameters from DB.
85  // watch the label/tag
87  setup.get<MixingRcd>().get(config);
88  minBunch_=config->minBunch();
89  maxBunch_=config->maxBunch();
90  bunchSpace_=config->bunchSpace();
91  }
const T & get() const
Definition: EventSetup.h:55
template<class T >
virtual void edm::MixingWorker< T >::setBcrOffset ( )
inlinevirtual

Implements edm::MixingWorkerBase.

Definition at line 144 of file MixingWorker.h.

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

144 {crFrame_->setBcrOffset();}
CrossingFrame< T > * crFrame_
Definition: MixingWorker.h:178
template<class T >
virtual void edm::MixingWorker< T >::setSourceOffset ( const unsigned int  s)
inlinevirtual

Implements edm::MixingWorkerBase.

Definition at line 145 of file MixingWorker.h.

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

145 {crFrame_->setSourceOffset(s);}
CrossingFrame< T > * crFrame_
Definition: MixingWorker.h:178
template<class T >
void MixingWorker::setTof ( )
virtual

Implements edm::MixingWorkerBase.

Definition at line 230 of file MixingWorker.h.

230 {;}

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
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