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)
 
 MixItr (const MixCollection *shc, int nrDets, end_tag)
 
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

◆ MixItr() [1/3]

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

constructors

Definition at line 67 of file MixCollection.h.

67 : first_(true), internalCtr_(0) { ; }

◆ MixItr() [2/3]

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

Definition at line 68 of file MixCollection.h.

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  }

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

◆ MixItr() [3/3]

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  }

◆ ~MixItr()

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

Default destructor

Definition at line 80 of file MixCollection.h.

80 { ; }

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

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 }

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

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

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 }

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

◆ getPileupEventNr()

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

◆ getSourceType()

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

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

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_) {
274  if (ok)
275  return *this;
276  trigger_ = false;
277  }
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 }

References convertSQLiteXML::ok.

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

◆ operator!=()

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

Definition at line 88 of file MixCollection.h.

88 { return internalCtr2_ != itr.internalCtr2_; }

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

◆ operator*()

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

Definition at line 85 of file MixCollection.h.

85 { return *(pMixItr_.operator*()); }

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

◆ operator++() [1/2]

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

Definition at line 86 of file MixCollection.h.

86 { return next(); }

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

◆ operator++() [2/2]

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

Definition at line 87 of file MixCollection.h.

87 { return next(); }

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

◆ operator->()

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

operators

Definition at line 84 of file MixCollection.h.

84 { return *(pMixItr_.operator->()); }

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

◆ reset()

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

Definition at line 118 of file MixCollection.h.

118 { ; }

Member Data Documentation

◆ first_

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

Definition at line 110 of file MixCollection.h.

◆ internalCtr2_

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

◆ internalCtr_

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

◆ iPileup_

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

Definition at line 111 of file MixCollection.h.

◆ iSignal_

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

Definition at line 111 of file MixCollection.h.

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

◆ mixCol_

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

Definition at line 108 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 109 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 105 of file MixCollection.h.

◆ trigger_

template<class T>
bool MixCollection< T >::MixItr::trigger_
private
mps_fire.i
i
Definition: mps_fire.py:355
MixCollection::MixItr::internalCtr_
unsigned int internalCtr_
Definition: MixCollection.h:113
MixCollection::MixItr::trigger_
bool trigger_
Definition: MixCollection.h:112
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
dqmdumpme.first
first
Definition: dqmdumpme.py:55
MixCollection::MixItr::mixCol_
const MixCollection * mixCol_
Definition: MixCollection.h:108
alignCSCRings.s
s
Definition: alignCSCRings.py:92
MixCollection::MixItr::pMixItr_
std::vector< const T * >::const_iterator pMixItr_
Definition: MixCollection.h:104
dqmdumpme.last
last
Definition: dqmdumpme.py:56
MixCollection::MixItr::getNewSignal
bool getNewSignal(typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
Definition: MixCollection.h:224
MixCollection::MixItr::getTrigger
bool getTrigger() const
Definition: MixCollection.h:98
MixCollection::MixItr::iPileup_
int iPileup_
Definition: MixCollection.h:111
MixCollection::MixItr::pMixItrEnd_
std::vector< const T * >::const_iterator pMixItrEnd_
Definition: MixCollection.h:105
MixCollection::crossingFrames_
std::vector< const CrossingFrame< T > * > crossingFrames_
Definition: MixCollection.h:137
MixCollection::MixItr::nrDets_
int nrDets_
Definition: MixCollection.h:109
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
MixCollection::MixItr::getNewPileups
bool getNewPileups(typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
Definition: MixCollection.h:239
MixCollection::MixItr::internalCtr2_
unsigned int internalCtr2_
Definition: MixCollection.h:114
MixCollection::MixItr::iSignal_
int iSignal_
Definition: MixCollection.h:111
MixCollection::MixItr::next
const MixItr next()
Definition: MixCollection.h:257
MixCollection::MixItr::myCF_
const CrossingFrame< T > * myCF_
Definition: MixCollection.h:107
MixCollection::MixItr::first_
bool first_
Definition: MixCollection.h:110