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.

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

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

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

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

◆ bunchrange()

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

Definition at line 18 of file MixCollection.h.

18 { return bunchRange_; }

References MixCollection< T >::bunchRange_.

◆ end()

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

Definition at line 293 of file MixCollection.h.

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

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

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  }

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

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 }

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

◆ inRegistry()

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

Definition at line 23 of file MixCollection.h.

23 { 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 204 of file MixCollection.h.

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 }

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

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

◆ sizeSignal()

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

Definition at line 214 of file MixCollection.h.

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

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 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
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
MixCollection::sizeSignal
int sizeSignal() const
Definition: MixCollection.h:214
alignCSCRings.s
s
Definition: alignCSCRings.py:92
dqmdumpme.last
last
Definition: dqmdumpme.py:56
MixCollection::size
int size() const
Definition: MixCollection.h:19
MixCollection::range
std::pair< int, int > range
Definition: MixCollection.h:13
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
MixCollection::nrDets_
int nrDets_
Definition: MixCollection.h:134
MixCollection::crossingFrames_
std::vector< const CrossingFrame< T > * > crossingFrames_
Definition: MixCollection.h:136
NULL
#define NULL
Definition: scimark2.h:8
MixCollection::sizePileup
int sizePileup() const
Definition: MixCollection.h:204
Exception
Definition: hltDiff.cc:245
MixCollection::inRegistry_
bool inRegistry_
Definition: MixCollection.h:133
MixCollection::MixItr
friend class MixItr
Definition: MixCollection.h:57
MixCollection::bunchRange_
range bunchRange_
Definition: MixCollection.h:132