1 #ifndef CROSSING_FRAME_H 2 #define CROSSING_FRAME_H 94 typename std::vector<const T*>::const_iterator&
last)
const {
99 typename std::vector<const T*>::const_iterator&
last)
const;
117 throw cms::Exception(
"BadIndex") <<
"CrossingFrame::getObject called with an invalid index- index was " << ip
163 std::vector<std::shared_ptr<edm::Wrapper<std::vector<T> >
const> >
shPtrPileups_;
182 : firstCrossing_(minb), lastCrossing_(maxb), bunchSpace_(bunchsp), subdet_(subdet), maxNbSources_(maxNbSources) {
191 template <
typename T>
196 subdet_.swap(
other.subdet_);
201 signals_.swap(
other.signals_);
202 pileups_.swap(
other.pileups_);
203 shPtrPileups_.swap(
other.shPtrPileups_);
204 shPtrPileups2_.swap(
other.shPtrPileups2_);
205 shPtrPileupsPCF_.swap(
other.shPtrPileupsPCF_);
206 pileupOffsetsBcr_.swap(
other.pileupOffsetsBcr_);
207 pileupOffsetsSource_.resize(maxNbSources_);
208 for (
unsigned int i = 0;
i < pileupOffsetsSource_.size(); ++
i) {
209 pileupOffsetsSource_[
i].swap(
other.pileupOffsetsSource_[
i]);
213 template <
typename T>
222 typename std::vector<const T*>::const_iterator&
last)
const {
223 first = pileups_.begin();
224 last = pileups_.end();
235 unsigned int bcr = getBunchCrossing(ip) - firstCrossing_;
236 for (
unsigned int i = 0;
i < pileupOffsetsSource_.size() - 1; ++
i) {
237 if (ip >= (pileupOffsetsSource_[
i])[bcr] && ip < (pileupOffsetsSource_[
i + 1])[bcr])
240 return pileupOffsetsSource_.size() - 1;
246 for (
unsigned int ii = 1;
ii < pileupOffsetsBcr_.size();
ii++) {
247 if (ip >= pileupOffsetsBcr_[
ii - 1] && ip < pileupOffsetsBcr_[
ii])
248 return ii + firstCrossing_ - 1;
250 if (ip < pileups_.size())
251 return lastCrossing_;
257 template <
typename T>
266 std::ostream& operator<<(std::ostream& o, const CrossingFrame<T>& cf) {
267 std::pair<int, int>
range = cf.getBunchRange();
268 o <<
"\nCrossingFrame for subdet " << cf.getEventID() <<
", bunchrange = " <<
range.first <<
"," <<
range.second
269 <<
", bunchSpace " << cf.getBunchSpace();
277 shPtrPileupsPCF_ = shPtr;
283 pileups_.push_back(&product);
289 for (
auto const&
item : product) {
290 pileups_.push_back(&
item);
299 for (
unsigned int i = 0;
i < vec->size(); ++
i) {
300 signals_.push_back(&((*vec)[
i]));
308 signals_.push_back(product);
void addSignals(const std::vector< T > *vec, edm::EventID id)
void addPileups(std::vector< T > const &vec)
void setEventID(edm::EventID evId)
void print(int level=0) const
const std::vector< const T * > & getPileups() const
unsigned int getNrPileups() const
int getSourceType(unsigned int ip) const
void setMaxNbSources(unsigned int mNbS)
unsigned int getPileupFileNr() const
void getSignal(typename std::vector< const T *>::const_iterator &first, typename std::vector< const T *>::const_iterator &last) const
void setPileupFileNr(unsigned int pFileNr)
void setIdFirstPileup(edm::EventID idFP)
unsigned int getNrPileups(int bcr) const
edm::EventID getEventID() const
void setSubDet(std::string det)
unsigned int maxNbSources_
std::vector< std::shared_ptr< edm::Wrapper< T > const > > shPtrPileups2_
unsigned int getNrSignals() const
edm::EventID idFirstPileup_
int getBunchCrossing(unsigned int ip) const
void setBunchRange(std::pair< int, int > bunchRange)
std::vector< unsigned int > pileupOffsetsBcr_
void setPileupPtr(std::shared_ptr< edm::Wrapper< std::vector< T > > const > shPtr)
void setPileupOffsetsBcr(const std::vector< unsigned int > &pOffsetsBcr)
std::shared_ptr< edm::Wrapper< PCrossingFrame< T > > const > shPtrPileupsPCF_
void setBunchSpace(int bSpace)
void setPileupOffsetsSource(const std::vector< std::vector< unsigned int > > &pOffsetsS)
int getBunchSpace() const
std::vector< std::vector< unsigned int > > pileupOffsetsSource_
void setPileupPtr(std::shared_ptr< edm::Wrapper< T > const > shPtr)
std::string getSubDet() const
const T & getObject(unsigned int ip) const
const std::vector< const T * > & getSignal() const
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
edm::EventID getIdFirstPileup() const
const std::vector< unsigned int > & getPileupOffsetsBcr() const
void swap(CrossingFrame &other)
std::pair< int, int > getBunchRange() const
unsigned int getMaxNbSources() const
unsigned int pileupFileNr_
std::vector< const T * > pileups_
void setPileups(const std::vector< const T *> &p)
void setSourceOffset(const unsigned int s)
std::vector< const T * > signals_
CrossingFrame & operator=(CrossingFrame const &rhs)
std::vector< std::shared_ptr< edm::Wrapper< std::vector< T > > const > > shPtrPileups_
void swap(CrossingFrame< T > &lhs, CrossingFrame< T > &rhs)