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

Member Typedef Documentation

◆ iterator

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

Definition at line 126 of file MixCollection.h.

◆ range

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

Definition at line 14 of file MixCollection.h.

Constructor & Destructor Documentation

◆ MixCollection() [1/3]

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

Definition at line 146 of file MixCollection.h.

146  : bunchRange_(0, 0), inRegistry_(false), nrDets_(0) {
147  crossingFrames_.push_back(NULL);
148 }

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

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

289  {
290  return MixItr(this, nrDets_)++;
291 }

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

◆ bunchrange()

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

Definition at line 19 of file MixCollection.h.

19 { return bunchRange_; }

References MixCollection< T >::bunchRange_.

◆ end()

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

Definition at line 294 of file MixCollection.h.

294  {
295  return MixItr(this, nrDets_, typename MixItr::end_tag());
296 }

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

◆ getObject()

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

Definition at line 27 of file MixCollection.h.

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

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

Referenced by GenParticleProducer::produce().

◆ init()

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

Definition at line 185 of file MixCollection.h.

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

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

◆ inRegistry()

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

Definition at line 24 of file MixCollection.h.

24 { return inRegistry_; }

References MixCollection< T >::inRegistry_.

◆ size()

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

◆ sizePileup()

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

Definition at line 205 of file MixCollection.h.

205  {
206  // get size cumulated for all subdetectors
207  int s = 0;
208  for (int i = 0; i < nrDets_; ++i) {
209  s += crossingFrames_[i]->getNrPileups();
210  }
211  return s;
212 }

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

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

◆ sizeSignal()

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

Definition at line 215 of file MixCollection.h.

215  {
216  int s = 0;
217  for (int i = 0; i < nrDets_; ++i) {
218  s += crossingFrames_[i]->getNrSignals();
219  }
220  return s;
221 }

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

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

Friends And Related Function Documentation

◆ MixItr

template<class T>
friend class MixItr
friend

Definition at line 58 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 133 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 134 of file MixCollection.h.

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

◆ nrDets_

template<class T>
int MixCollection< T >::nrDets_
private
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
dqmdumpme.first
first
Definition: dqmdumpme.py:55
MixCollection::sizeSignal
int sizeSignal() const
Definition: MixCollection.h:215
alignCSCRings.s
s
Definition: alignCSCRings.py:92
dqmdumpme.last
last
Definition: dqmdumpme.py:56
MixCollection::size
int size() const
Definition: MixCollection.h:20
MixCollection::range
std::pair< int, int > range
Definition: MixCollection.h:14
MixCollection::nrDets_
int nrDets_
Definition: MixCollection.h:135
MixCollection::crossingFrames_
std::vector< const CrossingFrame< T > * > crossingFrames_
Definition: MixCollection.h:137
NULL
#define NULL
Definition: scimark2.h:8
MixCollection::sizePileup
int sizePileup() const
Definition: MixCollection.h:205
Exception
Definition: hltDiff.cc:246
MixCollection::inRegistry_
bool inRegistry_
Definition: MixCollection.h:134
MixCollection::MixItr
friend class MixItr
Definition: MixCollection.h:58
MixCollection::bunchRange_
range bunchRange_
Definition: MixCollection.h:133