1 #ifndef MIX_COLLECTION_H 2 #define MIX_COLLECTION_H 16 typedef std::pair<int,int>
range;
19 const range bunchRange =
range(-999,999));
21 const range bunchRange =
range(-999,999));
32 if (ip>=(
unsigned int)
size())
throw cms::Exception(
"BadIndex")<<
"MixCollection::getObject called with an invalid index!";
55 throw cms::Exception(
"InternalError")<<
"MixCollection::getObject reached impossible condition";
69 for(
int i=0;
i<nrDets; ++
i) {
103 typename std::vector<const T *>::const_iterator
pMixItr_;
117 bool getNewSignal(
typename std::vector<const T *>::const_iterator &
first,
typename std::vector<const T *>::const_iterator &
last);
119 bool getNewPileups(
typename std::vector<const T *>::const_iterator &first,
typename std::vector<const T *>::const_iterator &last) ;
123 iterator
begin()
const;
124 iterator
end()
const;
127 void init(
const range bunchRange);
159 else edm::LogWarning(
"MixCollectionInvalidCtr") <<
"Could not construct MixCollection for "<<
typeid(
T).
name() <<
", pointer to CrossingFrame invalid!"<<std::endl;
166 range bR=cfs[0]->getBunchRange();
167 for (
unsigned int i=1;
i<cfs.size();++
i) {
168 if (bR!= cfs[
i]->getBunchRange())
throw cms::Exception(
"Incompatible CrossingFrames")<<
"You gave as input CrossingFrames with different bunchRanges!";
172 for (
unsigned int i=0;
i<cfs.size();++
i) {
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";
219 mixCol_->crossingFrames_[iSignal_]->getSignal(first,last);
220 myCF_=mixCol_->crossingFrames_[iSignal_];
222 if (first != last)
return true;
234 for (
typename std::vector<const T*>::const_iterator it=first;it!=
last ;it++) {
237 myCF_=mixCol_->crossingFrames_[iPileup_];
239 if (first!=last)
return true;
253 if (!trigger_) internalCtr_++;
254 if (++pMixItr_!=pMixItrEnd_)
return *
this;
260 ok=this->getNewSignal(pMixItr_,pMixItrEnd_);
261 if (ok)
return *
this;
264 ok=this->getNewPileups(pMixItr_,pMixItrEnd_);
267 typename std::vector<const T *>::const_iterator dbIt;
288 std::ostream &operator<<(std::ostream& o, const MixCollection<T>&
col)
290 o <<
"MixCollection with bunchRange: "<<(
col.bunchrange()).
first<<
"," << (
col.bunchrange()).
second <<
" size of signal: "<<
col.sizeSignal() <<
" ,size of pileup: "<<
col.sizePileup();
const CrossingFrame< T > * myCF_
const T * operator->() const
const MixCollection * mixCol_
MixItr(const MixCollection *shc, int nrDets, end_tag)
const T & operator*() const
MixItr(const MixCollection *shc, int nrDets)
U second(std::pair< T, U > const &p)
std::vector< const T * > getSignal() const
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)
std::vector< const T * > getPileups() const
unsigned int internalCtr2_
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_
int getPileupEventNr() const
int getSourceType() const
void init(const range bunchRange)
std::pair< int, int > range
unsigned int internalCtr_
const MixItr operator++()