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

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

Definition at line 122 of file MixCollection.h.

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

Definition at line 16 of file MixCollection.h.

Constructor & Destructor Documentation

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

Definition at line 143 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, mps_fire::i, MixCollection< T >::init(), MixCollection< T >::inRegistry_, dataset::name, MixCollection< T >::nrDets_, and NULL.

143  :
144  bunchRange_(0,0), inRegistry_(false), nrDets_(0)
145 {
146  crossingFrames_.push_back(NULL);
147 }
#define NULL
Definition: scimark2.h:8
std::vector< const CrossingFrame< T > * > crossingFrames_
template<class T>
MixCollection< T >::MixCollection ( const CrossingFrame< T > *  cf,
const range  bunchRange = range(-999, 999) 
)
template<class T>
MixCollection< T >::MixCollection ( const std::vector< const CrossingFrame< T > * > &  cfs,
const range  bunchRange = range(-999, 999) 
)

Member Function Documentation

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

Definition at line 23 of file MixCollection.h.

References MixCollection< T >::bunchRange_.

23 {return bunchRange_;}
template<class T >
MixCollection< T >::MixItr MixCollection< T >::end ( void  ) const
template<class T>
const T& MixCollection< T >::getObject ( unsigned int  ip) const
inline

Definition at line 31 of file MixCollection.h.

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

Referenced by GenParticleProducer::produce().

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

Definition at line 182 of file MixCollection.h.

References MixCollection< T >::bunchRange_, MixCollection< T >::crossingFrames_, Exception, plotBeamSpotDB::first, and plotBeamSpotDB::last.

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

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

Definition at line 28 of file MixCollection.h.

References MixCollection< T >::inRegistry_.

28 {return inRegistry_;}
template<class T>
int MixCollection< T >::size ( void  ) const
inline
template<class T >
int MixCollection< T >::sizePileup ( ) const

Definition at line 198 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, mps_fire::i, MixCollection< T >::nrDets_, and alignCSCRings::s.

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

198  {
199  // get size cumulated for all subdetectors
200  int s=0;
201  for (int i=0;i<nrDets_;++i) {
202  s+=crossingFrames_[i]->getNrPileups();
203  } return s;
204 }
std::vector< const CrossingFrame< T > * > crossingFrames_
template<class T >
int MixCollection< T >::sizeSignal ( ) const

Definition at line 206 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, mps_fire::i, MixCollection< T >::nrDets_, and alignCSCRings::s.

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

206  {
207  int s=0;
208  for (int i=0;i<nrDets_;++i) {
209  s+=crossingFrames_[i]->getNrSignals();
210  }
211  return s;
212 }
std::vector< const CrossingFrame< T > * > crossingFrames_

Friends And Related Function Documentation

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

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

Definition at line 129 of file MixCollection.h.

Referenced by MixCollection< T >::bunchrange(), and MixCollection< T >::init().

template<class T>
std::vector<const CrossingFrame<T> *> MixCollection< T >::crossingFrames_
private
template<class T>
bool MixCollection< T >::inRegistry_
private
template<class T>
int MixCollection< T >::nrDets_
private