1 #ifndef MIX_COLLECTION_H 2 #define MIX_COLLECTION_H 13 typedef std::pair<int, int>
range;
27 if (ip >= (
unsigned int)
size())
29 <<
"MixCollection::getObject called with an invalid index!";
38 for (
unsigned int iframe = 0; iframe <
crossingFrames_.size(); ++iframe) {
47 for (
unsigned int iframe = 0; iframe <
crossingFrames_.size(); ++iframe) {
54 throw cms::Exception(
"InternalError") <<
"MixCollection::getObject reached impossible condition";
68 for (
int i = 0;
i < nrDets; ++
i) {
103 typename std::vector<const T *>::const_iterator
pMixItr_;
119 typename std::vector<const T *>::const_iterator &
last);
122 typename std::vector<const T *>::const_iterator &
last);
151 : inRegistry_(
false), nrDets_(0) {
158 throw cms::Exception(
"InvalidPtr") <<
"Could not construct MixCollection for " <<
typeid(
T).
name()
159 <<
", pointer to CrossingFrame invalid!";
164 : inRegistry_(
false), nrDets_(0) {
166 range bR = cfs[0]->getBunchRange();
167 for (
unsigned int i = 1;
i < cfs.size(); ++
i) {
168 if (bR != cfs[
i]->getBunchRange())
170 <<
"You gave as input CrossingFrames with different bunchRanges!";
174 for (
unsigned int i = 0;
i < cfs.size(); ++
i) {
185 bunchRange_ = bunchRange;
189 range defaultrange = crossingFrames_[0]->getBunchRange();
190 if (bunchRange_ ==
range(-999, 999))
191 bunchRange_ = defaultrange;
192 else if (bunchRange_ != defaultrange) {
193 int first = defaultrange.first;
194 int last = defaultrange.second;
195 if (bunchRange_.first < defaultrange.first || bunchRange_.second > defaultrange.second)
197 <<
" You are asking for a runrange (" << bunchRange_.first <<
"," << bunchRange_.second
198 <<
"), outside of the existing runrange (" << defaultrange.first <<
", " << defaultrange.second <<
")\n";
207 for (
int i = 0;
i < nrDets_; ++
i) {
208 s += crossingFrames_[
i]->getNrPileups();
216 for (
int i = 0;
i < nrDets_; ++
i) {
217 s += crossingFrames_[
i]->getNrSignals();
224 typename std::vector<const T *>::const_iterator &
last) {
239 typename std::vector<const T *>::const_iterator &
last) {
242 mixCol_->crossingFrames_[iPileup_]->getPileups(
first,
last);
244 for (
typename std::vector<const T *>::const_iterator it =
first; it !=
last; it++) {
247 myCF_ = mixCol_->crossingFrames_[iPileup_];
265 if (++pMixItr_ != pMixItrEnd_)
272 ok = this->getNewSignal(pMixItr_, pMixItrEnd_);
277 ok = this->getNewPileups(pMixItr_, pMixItrEnd_);
300 std::ostream &operator<<(std::ostream &o, const MixCollection<T> &
col) {
301 o <<
"MixCollection with bunchRange: " << (
col.bunchrange()).
first <<
"," << (
col.bunchrange()).
second 302 <<
" size of signal: " <<
col.sizeSignal() <<
" ,size of pileup: " <<
col.sizePileup();
const CrossingFrame< T > * myCF_
const std::vector< const T * > & getPileups() const
const MixCollection * mixCol_
int getSourceType() const
bool getNewSignal(typename std::vector< const T *>::const_iterator &first, typename std::vector< const T *>::const_iterator &last)
std::pair< int, int > range
const MixItr operator++(int)
const T & getObject(unsigned int ip) const
int getPileupEventNr() const
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 CrossingFrame< T > * > crossingFrames_
bool operator!=(const MixItr &itr)
unsigned int internalCtr2_
std::vector< const T * >::const_iterator pMixItr_
const std::vector< const T * > & getSignal() const
std::vector< const T * >::const_iterator pMixItrEnd_
bool getNewPileups(typename std::vector< const T *>::const_iterator &first, typename std::vector< const T *>::const_iterator &last)
void init(const range bunchRange)
const T & operator*() const
unsigned int internalCtr_
const MixItr operator++()