CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
MixCollection< T >::MixItr Class Reference

#include <MixCollection.h>

Classes

struct  end_tag
 

Public Member Functions

int bunch () const
 
int getPileupEventNr () const
 
int getSourceType () const
 
bool getTrigger () const
 
 MixItr ()
 
 MixItr (const MixCollection *shc, int nrDets, end_tag)
 
 MixItr (const MixCollection *shc, int nrDets)
 
bool operator!= (const MixItr &itr)
 
const Toperator* () const
 
const MixItr operator++ ()
 
const MixItr operator++ (int)
 
const Toperator-> () const
 
virtual ~MixItr ()
 

Private Member Functions

bool getNewPileups (typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
 
bool getNewSignal (typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
 
const MixItr next ()
 
void reset ()
 

Private Attributes

bool first_
 
unsigned int internalCtr2_
 
unsigned int internalCtr_
 
int iPileup_
 
int iSignal_
 
const MixCollectionmixCol_
 
const CrossingFrame< T > * myCF_
 
int nrDets_
 
std::vector< const T * >::const_iterator pMixItr_
 
std::vector< const T * >::const_iterator pMixItrEnd_
 
bool trigger_
 

Detailed Description

template<class T>
class MixCollection< T >::MixItr

Definition at line 62 of file MixCollection.h.

Constructor & Destructor Documentation

template<class T>
MixCollection< T >::MixItr::MixItr ( )
inline

constructors

Definition at line 67 of file MixCollection.h.

67 : first_(true), internalCtr_(0) { ; }
unsigned int internalCtr_
template<class T>
MixCollection< T >::MixItr::MixItr ( const MixCollection shc,
int  nrDets,
end_tag   
)
inline

Definition at line 68 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, CrossingFrame< T >::getPileups(), CrossingFrame< T >::getSignal(), mps_fire::i, and MixCollection< T >::MixItr::internalCtr2_.

68  : internalCtr2_(0) {
69  for (int i = 0; i < nrDets; ++i) {
70  const auto &cf = shc->crossingFrames_[i];
71  internalCtr2_ += cf->getSignal().size() + cf->getPileups().size();
72  }
73  }
std::vector< const CrossingFrame< T > * > crossingFrames_
unsigned int internalCtr2_
template<class T>
MixCollection< T >::MixItr::MixItr ( const MixCollection shc,
int  nrDets 
)
inline

Definition at line 74 of file MixCollection.h.

75  : mixCol_(shc), nrDets_(nrDets), first_(true), iSignal_(0), iPileup_(0), internalCtr_(0) {
76  ;
77  }
const MixCollection * mixCol_
unsigned int internalCtr_
template<class T>
virtual MixCollection< T >::MixItr::~MixItr ( )
inlinevirtual

Default destructor

Definition at line 80 of file MixCollection.h.

80 { ; }

Member Function Documentation

template<class T>
int MixCollection< T >::MixItr::bunch ( ) const
inline

getters

Definition at line 91 of file MixCollection.h.

References MixCollection< T >::MixItr::internalCtr_, MixCollection< T >::MixItr::myCF_, and MixCollection< T >::MixItr::trigger_.

Referenced by edm::TestMix::analyze(), TestSuite::analyze(), GlobalTest::analyze(), edm::TestMixedSource::analyze(), and GenPUProtonProducer::produce().

91  {
92  if (trigger_)
93  return 0;
94  int bcr = myCF_->getBunchCrossing(internalCtr_);
95  return bcr;
96  }
const CrossingFrame< T > * myCF_
unsigned int internalCtr_
template<class T >
bool MixCollection< T >::MixItr::getNewPileups ( typename std::vector< const T * >::const_iterator &  first,
typename std::vector< const T * >::const_iterator &  last 
)
private

Definition at line 239 of file MixCollection.h.

References plotBeamSpotDB::last, MixCollection< T >::nrDets_, and alignCSCRings::s.

Referenced by MixCollection< T >::MixItr::reset().

240  {
241  // gets the next pileup collection , changing subdet if necessary
242  while (iPileup_ < nrDets_) {
243  mixCol_->crossingFrames_[iPileup_]->getPileups(first, last);
244  int s = 0;
245  for (typename std::vector<const T *>::const_iterator it = first; it != last; it++) {
246  s++;
247  }
249  iPileup_++;
250  if (first != last)
251  return true;
252  }
253  return false;
254 }
const CrossingFrame< T > * myCF_
const MixCollection * mixCol_
std::vector< const CrossingFrame< T > * > crossingFrames_
template<class T >
bool MixCollection< T >::MixItr::getNewSignal ( typename std::vector< const T * >::const_iterator &  first,
typename std::vector< const T * >::const_iterator &  last 
)
private

Definition at line 224 of file MixCollection.h.

References MixCollection< T >::nrDets_.

Referenced by MixCollection< T >::MixItr::reset().

225  {
226  // gets the next signal collection with non-zero size
227 
228  while (iSignal_ < nrDets_) {
229  mixCol_->crossingFrames_[iSignal_]->getSignal(first, last);
231  iSignal_++;
232  if (first != last)
233  return true;
234  }
235  return false;
236 }
const CrossingFrame< T > * myCF_
const MixCollection * mixCol_
std::vector< const CrossingFrame< T > * > crossingFrames_
template<class T>
int MixCollection< T >::MixItr::getPileupEventNr ( ) const
inline

Definition at line 101 of file MixCollection.h.

References MixCollection< T >::MixItr::getTrigger(), MixCollection< T >::MixItr::internalCtr_, and MixCollection< T >::MixItr::myCF_.

101 { return (getTrigger() ? 0 : myCF_->getPileupEventNr(internalCtr_)); }
const CrossingFrame< T > * myCF_
bool getTrigger() const
Definition: MixCollection.h:98
unsigned int internalCtr_
template<class T>
int MixCollection< T >::MixItr::getSourceType ( ) const
inline

Definition at line 100 of file MixCollection.h.

References MixCollection< T >::MixItr::getTrigger(), MixCollection< T >::MixItr::internalCtr_, and MixCollection< T >::MixItr::myCF_.

Referenced by edm::TestMix::analyze().

100 { return (getTrigger() ? -1 : myCF_->getSourceType(internalCtr_)); }
const CrossingFrame< T > * myCF_
bool getTrigger() const
Definition: MixCollection.h:98
unsigned int internalCtr_
template<class T>
bool MixCollection< T >::MixItr::getTrigger ( ) const
inline
template<class T >
const MixCollection< T >::MixItr MixCollection< T >::MixItr::next ( void  )
private

Definition at line 257 of file MixCollection.h.

References convertSQLiteXML::ok.

Referenced by MixCollection< T >::MixItr::operator++().

257  {
258  // initialisation
259  if (first_) {
260  first_ = false;
261  trigger_ = true;
262  } else {
263  ++internalCtr2_;
264  if (!trigger_)
265  internalCtr_++;
266  if (++pMixItr_ != pMixItrEnd_)
267  return *this;
268  }
269 
270  // we have an end condition, look whether there are more collections
271  bool ok;
272  if (trigger_) {
273  ok = this->getNewSignal(pMixItr_, pMixItrEnd_);
274  if (ok)
275  return *this;
276  trigger_ = false;
277  }
278  ok = this->getNewPileups(pMixItr_, pMixItrEnd_);
279  if (ok) {
280  // debug print start
281  // for (auto dbIt=pMixItr_;dbIt!=pMixItrEnd_;++dbIt) printf("Found pointer %p\n",(*dbIt));fflush(stdout);
282  // debug print end
283  internalCtr_ = 0;
284  }
285  return *this; // with internalCtr2_ we can always return *this
286 }
bool getNewSignal(typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
unsigned int internalCtr2_
bool getNewPileups(typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
std::vector< const T * >::const_iterator pMixItr_
std::vector< const T * >::const_iterator pMixItrEnd_
unsigned int internalCtr_
template<class T>
bool MixCollection< T >::MixItr::operator!= ( const MixItr itr)
inline

Definition at line 88 of file MixCollection.h.

References MixCollection< T >::MixItr::internalCtr2_.

88 { return internalCtr2_ != itr.internalCtr2_; }
unsigned int internalCtr2_
template<class T>
const T& MixCollection< T >::MixItr::operator* ( void  ) const
inline

Definition at line 85 of file MixCollection.h.

References MixCollection< T >::MixItr::pMixItr_.

85 { return *(pMixItr_.operator*()); }
std::vector< const T * >::const_iterator pMixItr_
template<class T>
const MixItr MixCollection< T >::MixItr::operator++ ( void  )
inline

Definition at line 86 of file MixCollection.h.

References MixCollection< T >::MixItr::next().

86 { return next(); }
const MixItr next()
template<class T>
const MixItr MixCollection< T >::MixItr::operator++ ( int  )
inline

Definition at line 87 of file MixCollection.h.

References MixCollection< T >::MixItr::next().

87 { return next(); }
const MixItr next()
template<class T>
const T* MixCollection< T >::MixItr::operator-> ( ) const
inline

operators

Definition at line 84 of file MixCollection.h.

References MixCollection< T >::MixItr::pMixItr_.

84 { return *(pMixItr_.operator->()); }
std::vector< const T * >::const_iterator pMixItr_
template<class T>
void MixCollection< T >::MixItr::reset ( void  )
inlineprivate

Member Data Documentation

template<class T>
bool MixCollection< T >::MixItr::first_
private

Definition at line 110 of file MixCollection.h.

template<class T>
unsigned int MixCollection< T >::MixItr::internalCtr2_
private
Initial value:
=
0

Definition at line 114 of file MixCollection.h.

Referenced by MixCollection< T >::MixItr::MixItr(), and MixCollection< T >::MixItr::operator!=().

template<class T>
unsigned int MixCollection< T >::MixItr::internalCtr_
private
template<class T>
int MixCollection< T >::MixItr::iPileup_
private

Definition at line 111 of file MixCollection.h.

template<class T>
int MixCollection< T >::MixItr::iSignal_
private

Definition at line 111 of file MixCollection.h.

template<class T>
const MixCollection* MixCollection< T >::MixItr::mixCol_
private

Definition at line 108 of file MixCollection.h.

template<class T>
const CrossingFrame<T>* MixCollection< T >::MixItr::myCF_
private
template<class T>
int MixCollection< T >::MixItr::nrDets_
private

Definition at line 109 of file MixCollection.h.

template<class T>
std::vector<const T *>::const_iterator MixCollection< T >::MixItr::pMixItr_
private
template<class T>
std::vector<const T *>::const_iterator MixCollection< T >::MixItr::pMixItrEnd_
private

Definition at line 105 of file MixCollection.h.

template<class T>
bool MixCollection< T >::MixItr::trigger_
private