1 #ifndef MIX_COLLECTION_H
2 #define MIX_COLLECTION_H
15 typedef std::pair<int,int>
range;
31 if (ip>=(
unsigned int)
size())
throw cms::Exception(
"BadIndex")<<
"MixCollection::getObject called with an invalid index!";
54 throw cms::Exception(
"InternalError")<<
"MixCollection::getObject reached impossible condition";
96 typename std::vector<const T *>::const_iterator
pMixItr_;
109 bool getNewSignal(
typename std::vector<const T *>::const_iterator &
first,
typename std::vector<const T *>::const_iterator &
last);
111 bool getNewPileups(
typename std::vector<const T *>::const_iterator &
first,
typename std::vector<const T *>::const_iterator &
last) ;
136 bunchRange_(0,0), inRegistry_(
false), nrDets_(0)
143 inRegistry_(
false),nrDets_(0)
151 else std::cout <<
"Could not construct MixCollection for "<<
typeid(
T).
name() <<
", pointer to CrossingFrame invalid!"<<std::endl;
158 range bR=cfs[0]->getBunchRange();
159 for (
unsigned int i=1;
i<cfs.size();++
i) {
160 if (bR!= cfs[
i]->getBunchRange())
throw cms::Exception(
"Incompatible CrossingFrames")<<
"You gave as input CrossingFrames with different bunchRanges!";
164 for (
unsigned int i=0;
i<cfs.size();++
i) {
176 bunchRange_=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);
193 for (
int i=0;
i<nrDets_;++
i) {
194 s+=crossingFrames_[
i]->getNrPileups();
200 for (
int i=0;
i<nrDets_;++
i) {
201 s+=crossingFrames_[
i]->getNrSignals();
214 if (first != last)
return true;
226 for (
typename std::vector<const T*>::const_iterator it=first;it!=
last ;it++) {
229 myCF_=mixCol_->crossingFrames_[iPileup_];
231 if (first!=last)
return true;
244 if (!trigger_) internalCtr_++;
245 if (++pMixItr_!=pMixItrEnd_)
return *
this;
251 ok=this->getNewSignal(pMixItr_,pMixItrEnd_);
252 if (ok)
return *
this;
255 ok=this->getNewPileups(pMixItr_,pMixItrEnd_);
258 typename std::vector<const T *>::const_iterator dbIt;
265 return mixCol_->end();
276 typename std::vector<const T *>::const_iterator
first;
277 typename std::vector<const T*>::const_iterator
last;
285 std::ostream &operator<<(std::ostream& o, const MixCollection<T>&
col)
287 o <<
"MixCollection with bunchRange: "<<(
col.bunchrange()).
first<<
"," << (
col.bunchrange()).
second <<
" size of signal: "<<
col.sizeSignal() <<
" ,size of pileup: "<<
col.sizePileup();
MixItr(MixCollection *shc, int nrDets)
const CrossingFrame< T > * myCF_
const T * operator->() const
const T & operator*() const
U second(std::pair< T, U > const &p)
std::vector< const CrossingFrame< T > * > crossingFrames_
bool operator!=(const MixItr &itr)
bool getNewSignal(typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
bool getNewPileups(typename std::vector< const T * >::const_iterator &first, typename std::vector< const T * >::const_iterator &last)
std::vector< const T * >::const_iterator pMixItr_
const T & getObject(unsigned int ip) const
std::vector< const T * >::const_iterator pMixItrEnd_
MixItr(typename std::vector< const T * >::const_iterator it)
int getPileupEventNr() const
int getSourceType() const
void init(const range bunchRange)
std::pair< int, int > range
unsigned int internalCtr_