1 #ifndef MIX_COLLECTION_H
2 #define MIX_COLLECTION_H
16 typedef std::pair<int,int>
range;
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) ;
137 bunchRange_(0,0), inRegistry_(
false), nrDets_(0)
144 inRegistry_(
false),nrDets_(0)
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) {
177 bunchRange_=bunchRange;
181 range defaultrange=crossingFrames_[0]->getBunchRange();
182 if (bunchRange_==
range(-999,999)) bunchRange_=defaultrange;
183 else if (bunchRange_!=defaultrange ) {
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";
187 bunchRange_=
range(first,last);
194 for (
int i=0;
i<nrDets_;++
i) {
195 s+=crossingFrames_[
i]->getNrPileups();
201 for (
int i=0;
i<nrDets_;++
i) {
202 s+=crossingFrames_[
i]->getNrSignals();
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();
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
volatile std::atomic< bool > shutdown_flag false
void init(const range bunchRange)
std::pair< int, int > range
unsigned int internalCtr_