CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
MixCollection< T > Class Template Reference

#include <MixCollection.h>

Classes

class  MixItr
 

Public Types

typedef MixItr iterator
 
typedef std::pair< int, int > range
 

Public Member Functions

iterator begin () const
 
range bunchrange () const
 
iterator end () const
 
const TgetObject (unsigned int ip) const
 
bool inRegistry () const
 
 MixCollection ()
 
 MixCollection (const CrossingFrame< T > *cf, const range bunchRange=range(-999, 999))
 
 MixCollection (const std::vector< const CrossingFrame< T > *> &cfs, const range bunchRange=range(-999, 999))
 
int size () const
 
int sizePileup () const
 
int sizeSignal () const
 

Private Member Functions

void init (const range bunchRange)
 

Private Attributes

range bunchRange_
 
std::vector< const CrossingFrame< T > * > crossingFrames_
 
bool inRegistry_
 
int nrDets_
 

Friends

class MixItr
 

Detailed Description

template<class T>
class MixCollection< T >

Definition at line 10 of file MixCollection.h.

Member Typedef Documentation

◆ iterator

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

Definition at line 125 of file MixCollection.h.

◆ range

template<class T>
typedef std::pair<int, int> MixCollection< T >::range

Definition at line 13 of file MixCollection.h.

Constructor & Destructor Documentation

◆ MixCollection() [1/3]

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

Definition at line 145 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, and NULL.

145  : bunchRange_(0, 0), inRegistry_(false), nrDets_(0) {
146  crossingFrames_.push_back(NULL);
147 }
#define NULL
Definition: scimark2.h:8
std::vector< const CrossingFrame< T > * > crossingFrames_

◆ MixCollection() [2/3]

template<class T>
MixCollection< T >::MixCollection ( const CrossingFrame< T > *  cf,
const range  bunchRange = range(-999, 999) 
)

◆ MixCollection() [3/3]

template<class T>
MixCollection< T >::MixCollection ( const std::vector< const CrossingFrame< T > *> &  cfs,
const range  bunchRange = range(-999, 999) 
)

Member Function Documentation

◆ begin()

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

Definition at line 288 of file MixCollection.h.

References MixCollection< T >::MixItr, and MixCollection< T >::nrDets_.

288  {
289  return MixItr(this, nrDets_)++;
290 }
friend class MixItr
Definition: MixCollection.h:57

◆ bunchrange()

template<class T>
range MixCollection< T >::bunchrange ( ) const
inline

Definition at line 18 of file MixCollection.h.

References MixCollection< T >::bunchRange_.

18 { return bunchRange_; }

◆ end()

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

Definition at line 293 of file MixCollection.h.

References MixCollection< T >::MixItr, and MixCollection< T >::nrDets_.

293  {
294  return MixItr(this, nrDets_, typename MixItr::end_tag());
295 }
friend class MixItr
Definition: MixCollection.h:57

◆ getObject()

template<class T>
const T& MixCollection< T >::getObject ( unsigned int  ip) const
inline

Definition at line 26 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, Exception, dqmiodumpmetadata::n, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, and MixCollection< T >::size().

Referenced by GenParticleProducer::produce().

26  {
27  if (ip >= (unsigned int)size())
28  throw cms::Exception("BadIndex")
29  << "MixCollection::getObject called with an invalid index!"; // ip >= 0, since ip is unsigned
30  int n = ip;
31  /*
32 - int iframe=0;
33 - for (unsigned int ii=0;ii<crossingFrames_.size();++ii) {
34 - iframe=ii;
35 - int s=crossingFrames_[iframe]->getNrSignals()+crossingFrames_[iframe]->getNrPileups();
36 - if (n<s) break;
37 */
38  for (unsigned int iframe = 0; iframe < crossingFrames_.size(); ++iframe) {
39  int s = crossingFrames_[iframe]->getNrSignals();
40  if (n < s)
41  return crossingFrames_[iframe]->getObject(n);
42  n = n - s;
43  }
44  /*
45  return crossingFrames_[iframe]->getObject(n);
46 */
47  for (unsigned int iframe = 0; iframe < crossingFrames_.size(); ++iframe) {
48  int s = crossingFrames_[iframe]->getNrSignals();
49  int p = crossingFrames_[iframe]->getNrPileups();
50  if (n < p)
51  return crossingFrames_[iframe]->getObject(s + n);
52  n = n - p;
53  }
54  throw cms::Exception("InternalError") << "MixCollection::getObject reached impossible condition";
55  }
int size() const
Definition: MixCollection.h:19
std::vector< const CrossingFrame< T > * > crossingFrames_

◆ init()

template<class T>
void MixCollection< T >::init ( const range  bunchRange)
private

Definition at line 184 of file MixCollection.h.

References Exception, dqmdumpme::first, dqmdumpme::last, and FastTimerService_cff::range.

184  {
185  bunchRange_ = bunchRange;
186 
187  //verify whether bunchrange is ok
188  // in case of several crossingFrames, we have verified before that they have the same bunchrange
189  range defaultrange = crossingFrames_[0]->getBunchRange();
190  if (bunchRange_ == range(-999, 999))
191  bunchRange_ = defaultrange;
192  else if (bunchRange_ != defaultrange) {
193  int first = defaultrange.first;
194  int last = defaultrange.second;
195  if (bunchRange_.first < defaultrange.first || bunchRange_.second > defaultrange.second)
196  throw cms::Exception("BadRunRange")
197  << " You are asking for a runrange (" << bunchRange_.first << "," << bunchRange_.second
198  << "), outside of the existing runrange (" << defaultrange.first << ", " << defaultrange.second << ")\n";
200  }
201 }
std::pair< int, int > range
Definition: MixCollection.h:13
std::vector< const CrossingFrame< T > * > crossingFrames_

◆ inRegistry()

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

Definition at line 23 of file MixCollection.h.

References MixCollection< T >::inRegistry_.

23 { return inRegistry_; }

◆ size()

template<class T>
int MixCollection< T >::size ( void  ) const
inline

◆ sizePileup()

template<class T >
int MixCollection< T >::sizePileup ( ) const

Definition at line 204 of file MixCollection.h.

References mps_fire::i, and alignCSCRings::s.

Referenced by MixCollection< T >::size().

204  {
205  // get size cumulated for all subdetectors
206  int s = 0;
207  for (int i = 0; i < nrDets_; ++i) {
208  s += crossingFrames_[i]->getNrPileups();
209  }
210  return s;
211 }
std::vector< const CrossingFrame< T > * > crossingFrames_

◆ sizeSignal()

template<class T >
int MixCollection< T >::sizeSignal ( ) const

Definition at line 214 of file MixCollection.h.

References mps_fire::i, and alignCSCRings::s.

Referenced by MixCollection< T >::size().

214  {
215  int s = 0;
216  for (int i = 0; i < nrDets_; ++i) {
217  s += crossingFrames_[i]->getNrSignals();
218  }
219  return s;
220 }
std::vector< const CrossingFrame< T > * > crossingFrames_

Friends And Related Function Documentation

◆ MixItr

template<class T>
friend class MixItr
friend

Definition at line 57 of file MixCollection.h.

Referenced by MixCollection< T >::begin(), and MixCollection< T >::end().

Member Data Documentation

◆ bunchRange_

template<class T>
range MixCollection< T >::bunchRange_
private

Definition at line 132 of file MixCollection.h.

Referenced by MixCollection< T >::bunchrange().

◆ crossingFrames_

template<class T>
std::vector<const CrossingFrame<T> *> MixCollection< T >::crossingFrames_
private

◆ inRegistry_

template<class T>
bool MixCollection< T >::inRegistry_
private

Definition at line 133 of file MixCollection.h.

Referenced by MixCollection< T >::inRegistry().

◆ nrDets_

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