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

Member Typedef Documentation

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

Definition at line 114 of file MixCollection.h.

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

Definition at line 15 of file MixCollection.h.

Constructor & Destructor Documentation

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

Definition at line 135 of file MixCollection.h.

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

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

References MixCollection< T >::bunchRange_.

22 {return bunchRange_;}
template<class T >
MixCollection< T >::MixItr MixCollection< T >::end ( void  )

Definition at line 275 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(), CaloHitResponse::run(), CaloHitRespoNew::run(), and EcalHitResponse::run().

275  {
276  typename std::vector<const T *>::const_iterator first;
277  typename std::vector<const T*>::const_iterator last;
278  crossingFrames_[nrDets_-1]->getPileups(first, last);
279  return last;
280 }
std::vector< const CrossingFrame< T > * > crossingFrames_
bool first
Definition: L1TdeRCT.cc:79
template<class T>
const T& MixCollection< T >::getObject ( unsigned int  ip) const
inline

Definition at line 30 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().

30  {
31  if (ip>=(unsigned int)size()) throw cms::Exception("BadIndex")<<"MixCollection::getObject called with an invalid index!"; // ip >= 0, since ip is unsigned
32  int n=ip;
33 /*
34 - int iframe=0;
35 - for (unsigned int ii=0;ii<crossingFrames_.size();++ii) {
36 - iframe=ii;
37 - int s=crossingFrames_[iframe]->getNrSignals()+crossingFrames_[iframe]->getNrPileups();
38 - if (n<s) break;
39 */
40  for (unsigned int iframe=0;iframe<crossingFrames_.size();++iframe) {
41  int s=crossingFrames_[iframe]->getNrSignals();
42  if (n<s) 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) 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:23
std::vector< const CrossingFrame< T > * > crossingFrames_
template<class T>
void MixCollection< T >::init ( const range  bunchRange)
private

Definition at line 174 of file MixCollection.h.

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

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

Definition at line 27 of file MixCollection.h.

References MixCollection< T >::inRegistry_.

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

Definition at line 190 of file MixCollection.h.

References i, and alignCSCRings::s.

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

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

Definition at line 198 of file MixCollection.h.

References i, and alignCSCRings::s.

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

198  {
199  int s=0;
200  for (int i=0;i<nrDets_;++i) {
201  s+=crossingFrames_[i]->getNrSignals();
202  }
203  return s;
204 }
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 57 of file MixCollection.h.

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

Member Data Documentation

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

Definition at line 121 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 122 of file MixCollection.h.

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

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