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";
97 typename std::vector<const T *>::const_iterator
pMixItr_;
110 bool getNewSignal(
typename std::vector<const T *>::const_iterator &
first,
typename std::vector<const T *>::const_iterator &
last);
112 bool getNewPileups(
typename std::vector<const T *>::const_iterator &first,
typename std::vector<const T *>::const_iterator &last) ;
116 iterator
begin()
const;
117 iterator
end()
const;
120 void init(
const range bunchRange);
152 else edm::LogWarning(
"MixCollectionInvalidCtr") <<
"Could not construct MixCollection for "<<
typeid(
T).
name() <<
", pointer to CrossingFrame invalid!"<<std::endl;
159 range bR=cfs[0]->getBunchRange();
160 for (
unsigned int i=1;
i<cfs.size();++
i) {
161 if (bR!= cfs[
i]->getBunchRange())
throw cms::Exception(
"Incompatible CrossingFrames")<<
"You gave as input CrossingFrames with different bunchRanges!";
165 for (
unsigned int i=0;
i<cfs.size();++
i) {
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";
212 mixCol_->crossingFrames_[iSignal_]->getSignal(first,last);
213 myCF_=mixCol_->crossingFrames_[iSignal_];
215 if (first != last)
return true;
227 for (
typename std::vector<const T*>::const_iterator it=first;it!=
last ;it++) {
230 myCF_=mixCol_->crossingFrames_[iPileup_];
232 if (first!=last)
return true;
245 if (!trigger_) internalCtr_++;
246 if (++pMixItr_!=pMixItrEnd_)
return *
this;
252 ok=this->getNewSignal(pMixItr_,pMixItrEnd_);
253 if (ok)
return *
this;
256 ok=this->getNewPileups(pMixItr_,pMixItrEnd_);
259 typename std::vector<const T *>::const_iterator dbIt;
266 return mixCol_->end();
277 typename std::vector<const T *>::const_iterator
first;
278 typename std::vector<const T*>::const_iterator
last;
286 std::ostream &operator<<(std::ostream& o, const MixCollection<T>&
col)
288 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_
const T & operator*() const
MixItr(const MixCollection *shc, int nrDets)
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_
const MixItr operator++()