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 61 of file MixCollection.h.

Constructor & Destructor Documentation

◆ MixItr() [1/3]

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

constructors

Definition at line 66 of file MixCollection.h.

66 : first_(true), internalCtr_(0) { ; }
unsigned int internalCtr_

◆ MixItr() [2/3]

template<class T>
MixCollection< T >::MixItr::MixItr ( const MixCollection shc,
int  nrDets,
end_tag   
)
inline

Definition at line 67 of file MixCollection.h.

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

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

◆ MixItr() [3/3]

template<class T>
MixCollection< T >::MixItr::MixItr ( const MixCollection shc,
int  nrDets 
)
inline

Definition at line 73 of file MixCollection.h.

74  : mixCol_(shc), nrDets_(nrDets), first_(true), iSignal_(0), iPileup_(0), internalCtr_(0) {
75  ;
76  }
const MixCollection * mixCol_
unsigned int internalCtr_

◆ ~MixItr()

template<class T>
virtual MixCollection< T >::MixItr::~MixItr ( )
inlinevirtual

Default destructor

Definition at line 79 of file MixCollection.h.

79 { ; }

Member Function Documentation

◆ bunch()

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

◆ getNewPileups()

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 238 of file MixCollection.h.

References dqmdumpme::first, dqmdumpme::last, and MixCollection< T >::nrDets_.

239  {
240  // gets the next pileup collection , changing subdet if necessary
241  while (iPileup_ < nrDets_) {
242  mixCol_->crossingFrames_[iPileup_]->getPileups(first, last);
244  iPileup_++;
245  if (first != last)
246  return true;
247  }
248  return false;
249 }
const CrossingFrame< T > * myCF_
const MixCollection * mixCol_
std::vector< const CrossingFrame< T > * > crossingFrames_

◆ getNewSignal()

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 223 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, dqmdumpme::first, MixCollection< T >::MixItr::iSignal_, dqmdumpme::last, MixCollection< T >::MixItr::mixCol_, MixCollection< T >::MixItr::myCF_, and MixCollection< T >::MixItr::nrDets_.

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

◆ getPileupEventNr()

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

Definition at line 100 of file MixCollection.h.

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

100 { return (getTrigger() ? 0 : myCF_->getPileupEventNr(internalCtr_)); }
const CrossingFrame< T > * myCF_
bool getTrigger() const
Definition: MixCollection.h:97
unsigned int internalCtr_

◆ getSourceType()

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

Definition at line 99 of file MixCollection.h.

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

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

99 { return (getTrigger() ? -1 : myCF_->getSourceType(internalCtr_)); }
const CrossingFrame< T > * myCF_
bool getTrigger() const
Definition: MixCollection.h:97
unsigned int internalCtr_

◆ getTrigger()

template<class T>
bool MixCollection< T >::MixItr::getTrigger ( ) const
inline

◆ next()

template<class T >
const MixCollection< T >::MixItr MixCollection< T >::MixItr::next ( void  )
private

Definition at line 252 of file MixCollection.h.

References convertSQLiteXML::ok.

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

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

◆ operator!=()

template<class T>
bool MixCollection< T >::MixItr::operator!= ( const MixItr itr)
inline

Definition at line 87 of file MixCollection.h.

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

87 { return internalCtr2_ != itr.internalCtr2_; }
unsigned int internalCtr2_

◆ operator*()

template<class T>
const T& MixCollection< T >::MixItr::operator* ( void  ) const
inline

Definition at line 84 of file MixCollection.h.

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

84 { return *(pMixItr_.operator*()); }
std::vector< const T * >::const_iterator pMixItr_

◆ operator++() [1/2]

template<class T>
const MixItr MixCollection< T >::MixItr::operator++ ( void  )
inline

Definition at line 85 of file MixCollection.h.

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

85 { return next(); }
const MixItr next()

◆ operator++() [2/2]

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

Definition at line 86 of file MixCollection.h.

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

86 { return next(); }
const MixItr next()

◆ operator->()

template<class T>
const T* MixCollection< T >::MixItr::operator-> ( ) const
inline

operators

Definition at line 83 of file MixCollection.h.

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

83 { return *(pMixItr_.operator->()); }
std::vector< const T * >::const_iterator pMixItr_

◆ reset()

template<class T>
void MixCollection< T >::MixItr::reset ( void  )
inlineprivate

Definition at line 117 of file MixCollection.h.

117 { ; }

Member Data Documentation

◆ first_

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

Definition at line 109 of file MixCollection.h.

◆ internalCtr2_

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

Definition at line 113 of file MixCollection.h.

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

◆ internalCtr_

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

◆ iPileup_

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

Definition at line 110 of file MixCollection.h.

◆ iSignal_

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

Definition at line 110 of file MixCollection.h.

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

◆ mixCol_

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

Definition at line 107 of file MixCollection.h.

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

◆ myCF_

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

◆ nrDets_

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

Definition at line 108 of file MixCollection.h.

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

◆ pMixItr_

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

◆ pMixItrEnd_

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

Definition at line 104 of file MixCollection.h.

◆ trigger_

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