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

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

Default destructor

Definition at line 79 of file MixCollection.h.

79 {;}

Member Function Documentation

template<class T>
int MixCollection< T >::MixItr::bunch ( ) const
inline
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 228 of file MixCollection.h.

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

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

228  {
229 
230  // gets the next pileup collection , changing subdet if necessary
231  while (iPileup_<nrDets_) {
232  mixCol_-> crossingFrames_[iPileup_]->getPileups(first,last);
233  int s=0;
234  for (typename std::vector<const T*>::const_iterator it=first;it!= last ;it++) {
235  s++;
236  }
238  iPileup_++;
239  if (first!=last) return true;
240  }
241  return false;
242 }
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 215 of file MixCollection.h.

References MixCollection< T >::nrDets_.

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

215  {
216  // gets the next signal collection with non-zero size
217 
218  while (iSignal_<nrDets_) {
219  mixCol_->crossingFrames_[iSignal_]->getSignal(first,last);
221  iSignal_++;
222  if (first != last) return true;
223  }
224  return false;
225 }
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 99 of file MixCollection.h.

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

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

Definition at line 98 of file MixCollection.h.

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

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

98 {return (getTrigger() ? -1 : myCF_->getSourceType(internalCtr_));}
const CrossingFrame< T > * myCF_
bool getTrigger() const
Definition: MixCollection.h:96
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 245 of file MixCollection.h.

References convertSQLiteXML::ok.

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

245  {
246 
247  // initialisation
248  if (first_) {
249  first_=false;
250  trigger_=true;
251  } else {
252  ++internalCtr2_;
253  if (!trigger_) internalCtr_++;
254  if (++pMixItr_!=pMixItrEnd_) return *this;
255  }
256 
257  // we have an end condition, look whether there are more collections
258  bool ok;
259  if (trigger_) {
261  if (ok) return *this;
262  trigger_=false;
263  }
265  if (ok) {
266  // debug print start
267  // for (auto dbIt=pMixItr_;dbIt!=pMixItrEnd_;++dbIt) printf("Found pointer %p\n",(*dbIt));fflush(stdout);
268  // debug print end
269  internalCtr_=0;
270  }
271  return *this; // with internalCtr2_ we can always return *this
272 }
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 87 of file MixCollection.h.

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

87 { return internalCtr2_ != itr.internalCtr2_; }
unsigned int internalCtr2_
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_
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()
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()
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_
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 109 of file MixCollection.h.

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

Definition at line 110 of file MixCollection.h.

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

Definition at line 110 of file MixCollection.h.

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

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

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