CMS 3D CMS Logo

MixCollection< T > Class Template Reference

#include <SimDataFormats/CrossingFrame/interface/MixCollection.h>

List of all members.

Public Types

typedef MixItr iterator
typedef std::pair< int, intrange

Public Member Functions

iterator begin ()
range bunchrange () const
iterator end ()
const T & getObject (unsigned int ip) const
bool inRegistry () const
 MixCollection (std::vector< const CrossingFrame< T > * > cfs, const range bunchRange=range(-999, 999))
 MixCollection (const CrossingFrame< T > *cf, const range bunchRange=range(-999, 999))
 MixCollection ()
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

Classes

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 98 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 (  )  [inline]

Definition at line 119 of file MixCollection.h.

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

00119                                 : 
00120   bunchRange_(0,0), inRegistry_(false), nrDets_(0)
00121 {
00122   crossingFrames_.push_back(NULL);
00123 }

template<class T>
MixCollection< T >::MixCollection ( const CrossingFrame< T > *  cf,
const range  bunchRange = range(-999,999) 
) [inline]

Definition at line 126 of file MixCollection.h.

References GenMuonPlsPt100GeV_cfg::cout, MixCollection< T >::crossingFrames_, lat::endl(), MixCollection< T >::init(), MixCollection< T >::inRegistry_, name, and MixCollection< T >::nrDets_.

00126                                                                                             : 
00127   inRegistry_(false),nrDets_(0) 
00128 {
00129   nrDets_=1;
00130   inRegistry_=true;
00131   if (cf) {
00132     crossingFrames_.push_back(cf);
00133     init(bunchRange);
00134   }
00135   else std::cout <<"Could not construct MixCollection for "<<typeid(T).name() <<", pointer to CrossingFrame invalid!"<<std::endl;
00136 } 

template<class T>
MixCollection< T >::MixCollection ( std::vector< const CrossingFrame< T > * >  cfs,
const range  bunchRange = range(-999,999) 
) [inline]

Definition at line 139 of file MixCollection.h.

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

00139                                                                                                           :  inRegistry_(false) , nrDets_(0)
00140 {
00141   // first, verify that all CrossingFrames have the same bunchrange
00142   range bR=cfs[0]->getBunchRange();
00143   for (unsigned int i=1;i<cfs.size();++i) {
00144     if (bR!= cfs[i]->getBunchRange()) throw cms::Exception("Incompatible CrossingFrames")<<"You gave as input CrossingFrames with different bunchRanges!";
00145   }
00146 
00147   //set necessary variables
00148   for (unsigned int i=0;i<cfs.size();++i) {
00149     nrDets_++;
00150     crossingFrames_.push_back(cfs[i]);
00151     inRegistry_=true;  // true if at least one is present
00152   }
00153 
00154   init(bunchRange);
00155 }


Member Function Documentation

template<class T>
MixCollection< T >::MixItr MixCollection< T >::begin ( void   )  [inline]

Definition at line 250 of file MixCollection.h.

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

Referenced by GlobalTest::analyze(), TestSuite::analyze(), edm::TestMix::analyze(), CSCDigitizer::doAction(), RPCDigitizer::doAction(), DTHitAssociator::DTHitAssociator(), CastorHitCorrection::fillChargeSums(), HcalHitCorrection::fillChargeSums(), CaloHitAnalyzer::fillHits(), EcalEndcapRecHitsMaker::loadPCaloHits(), EcalBarrelRecHitsMaker::loadPCaloHits(), cms::DigitizerFP420::produce(), cms::SiPixelDigitizer::produce(), RPCHitAssociator::RPCHitAssociator(), CaloHitResponse::run(), SiTrackerGaussianSmearingRecHitConverter::smearHits(), and TrackerHitAssociator::TrackerHitAssociator().

00250                                                         {
00251   return MixItr(this,nrDets_)++;
00252 }

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

Definition at line 22 of file MixCollection.h.

00022 {return bunchRange_;}

template<class T>
MixCollection< T >::MixItr MixCollection< T >::end ( void   )  [inline]

Definition at line 255 of file MixCollection.h.

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

Referenced by GlobalTest::analyze(), TestSuite::analyze(), edm::TestMix::analyze(), CSCDigitizer::doAction(), RPCDigitizer::doAction(), DTHitAssociator::DTHitAssociator(), CastorHitCorrection::fillChargeSums(), HcalHitCorrection::fillChargeSums(), CaloHitAnalyzer::fillHits(), MixCollection< T >::MixItr::next(), cms::DigitizerFP420::produce(), cms::SiPixelDigitizer::produce(), RPCHitAssociator::RPCHitAssociator(), CaloHitResponse::run(), SiTrackerGaussianSmearingRecHitConverter::smearHits(), and TrackerHitAssociator::TrackerHitAssociator().

00255                                                        {
00256   typename std::vector<T>::const_iterator first;
00257   typename std::vector<T>::const_iterator last;
00258   crossingFrames_[nrDets_-1]->getPileups(first, last);
00259   return last;
00260 }

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

Definition at line 30 of file MixCollection.h.

Referenced by TrackerHitAssociator::associateHit().

00030                                              { 
00031     if (ip<0 || ip>=(unsigned int)size()) throw cms::Exception("BadIndex")<<"MixCollection::getObject called with an invalid index!";
00032     int n=ip;
00033     int iframe=0;
00034     for (unsigned int ii=0;ii<crossingFrames_.size();++ii) {
00035       iframe=ii;
00036       int s=crossingFrames_[iframe]->getNrSignals()+crossingFrames_[iframe]->getNrPileups();
00037       if (n<s) break;
00038       n=n-s;
00039     }
00040     return crossingFrames_[iframe]->getObject(n);
00041   }

template<class T>
void MixCollection< T >::init ( const range  bunchRange  )  [inline, private]

Definition at line 158 of file MixCollection.h.

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

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

00158                                                               {
00159 
00160   bunchRange_=bunchRange;
00161 
00162   //verify whether bunchrange is ok
00163   // in case of several crossingFrames, we have verified before that they have the same bunchrange
00164   range defaultrange=crossingFrames_[0]->getBunchRange();
00165   if (bunchRange_==range(-999,999)) bunchRange_=defaultrange;
00166   else if (bunchRange_!=defaultrange ) {
00167     int first=defaultrange.first;
00168     int last = defaultrange.second;
00169     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";
00170     bunchRange_=range(first,last);
00171   }
00172 }

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

Definition at line 27 of file MixCollection.h.

Referenced by EcalDigiProducer::produce().

00027 {return inRegistry_;}

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

Definition at line 23 of file MixCollection.h.

Referenced by MixCollection< SimTrack >::getObject(), and SiTrackerGaussianSmearingRecHitConverter::smearHits().

00023 {return sizeSignal() + sizePileup();}

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

Definition at line 174 of file MixCollection.h.

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

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

00174                                                             {
00175   // get size cumulated for all subdetectors
00176   int s=0;
00177   for (int i=0;i<nrDets_;++i) {
00178     s+=crossingFrames_[i]->getNrPileups();
00179   }  return s;
00180 }

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

Definition at line 182 of file MixCollection.h.

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

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

00182                                                             {
00183   int s=0;
00184   for (int i=0;i<nrDets_;++i) {
00185     s+=crossingFrames_[i]->getNrSignals();
00186   }
00187   return s;
00188 }


Friends And Related Function Documentation

template<class T>
friend class MixItr [friend]

Definition at line 43 of file MixCollection.h.

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


Member Data Documentation

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

Definition at line 105 of file MixCollection.h.

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

template<class T>
std::vector<const CrossingFrame<T> *> MixCollection< T >::crossingFrames_ [private]

Definition at line 109 of file MixCollection.h.

Referenced by MixCollection< T >::end(), MixCollection< T >::MixItr::getNewPileups(), MixCollection< T >::MixItr::getNewSignal(), MixCollection< SimTrack >::getObject(), MixCollection< T >::init(), MixCollection< T >::MixCollection(), MixCollection< T >::sizePileup(), and MixCollection< T >::sizeSignal().

template<class T>
bool MixCollection< T >::inRegistry_ [private]

Definition at line 106 of file MixCollection.h.

Referenced by MixCollection< SimTrack >::inRegistry(), and MixCollection< T >::MixCollection().

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

Definition at line 107 of file MixCollection.h.

Referenced by MixCollection< T >::begin(), MixCollection< T >::end(), MixCollection< T >::MixCollection(), MixCollection< T >::sizePileup(), and MixCollection< T >::sizeSignal().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:28:17 2009 for CMSSW by  doxygen 1.5.4