CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
range bunchrange () const
 
iterator end ()
 
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 115 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 136 of file MixCollection.h.

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

136  :
137  bunchRange_(0,0), inRegistry_(false), nrDets_(0)
138 {
139  crossingFrames_.push_back(NULL);
140 }
#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  )
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  )

Definition at line 276 of file MixCollection.h.

References MixCollection< T >::crossingFrames_, first, prof2calltree::last, and MixCollection< T >::nrDets_.

Referenced by RPCDigitizer::doAction(), CSCDigitizer::doAction(), CastorHitCorrection::fillChargeSums(), HcalHitCorrection::fillChargeSums(), CaloHitAnalyzer::fillHits(), EBHitResponse::run(), HcalSiPMHitResponse::run(), CaloHitRespoNew::run(), CaloHitResponse::run(), and EcalHitResponse::run().

276  {
277  typename std::vector<const T *>::const_iterator first;
278  typename std::vector<const T*>::const_iterator last;
279  crossingFrames_[nrDets_-1]->getPileups(first, last);
280  return last;
281 }
std::vector< const CrossingFrame< T > * > crossingFrames_
bool first
Definition: L1TdeRCT.cc:75
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_, edm::hlt::Exception, 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 175 of file MixCollection.h.

References edm::hlt::Exception, first, and prof2calltree::last.

175  {
176 
177  bunchRange_=bunchRange;
178 
179  //verify whether bunchrange is ok
180  // in case of several crossingFrames, we have verified before that they have the same bunchrange
181  range defaultrange=crossingFrames_[0]->getBunchRange();
182  if (bunchRange_==range(-999,999)) bunchRange_=defaultrange;
183  else if (bunchRange_!=defaultrange ) {
184  int first=defaultrange.first;
185  int last = defaultrange.second;
186  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";
187  bunchRange_=range(first,last);
188  }
189 }
std::vector< const CrossingFrame< T > * > crossingFrames_
bool first
Definition: L1TdeRCT.cc:75
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 191 of file MixCollection.h.

References i, and alignCSCRings::s.

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

191  {
192  // get size cumulated for all subdetectors
193  int s=0;
194  for (int i=0;i<nrDets_;++i) {
195  s+=crossingFrames_[i]->getNrPileups();
196  } return s;
197 }
int i
Definition: DBlmapReader.cc:9
std::vector< const CrossingFrame< T > * > crossingFrames_
template<class T >
int MixCollection< T >::sizeSignal ( ) const

Definition at line 199 of file MixCollection.h.

References i, and alignCSCRings::s.

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

199  {
200  int s=0;
201  for (int i=0;i<nrDets_;++i) {
202  s+=crossingFrames_[i]->getNrSignals();
203  }
204  return s;
205 }
int i
Definition: DBlmapReader.cc:9
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().

Member Data Documentation

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

Definition at line 122 of file MixCollection.h.

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

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

Definition at line 123 of file MixCollection.h.

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

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