1 #ifndef CROSSING_FRAME_H 2 #define CROSSING_FRAME_H 93 typename std::vector<const T*>::const_iterator&
last)
const {
98 typename std::vector<const T*>::const_iterator&
last)
const;
116 throw cms::Exception(
"BadIndex") <<
"CrossingFrame::getObject called with an invalid index- index was " << ip
162 std::vector<std::shared_ptr<edm::Wrapper<std::vector<T> >
const> >
shPtrPileups_;
181 : firstCrossing_(minb), lastCrossing_(maxb), bunchSpace_(bunchsp), subdet_(subdet), maxNbSources_(maxNbSources) {
190 template <
typename T>
195 subdet_.swap(
other.subdet_);
200 signals_.swap(
other.signals_);
201 pileups_.swap(
other.pileups_);
202 shPtrPileups_.swap(
other.shPtrPileups_);
203 shPtrPileups2_.swap(
other.shPtrPileups2_);
204 shPtrPileupsPCF_.swap(
other.shPtrPileupsPCF_);
205 pileupOffsetsBcr_.swap(
other.pileupOffsetsBcr_);
206 pileupOffsetsSource_.resize(maxNbSources_);
207 for (
unsigned int i = 0;
i < pileupOffsetsSource_.size(); ++
i) {
208 pileupOffsetsSource_[
i].swap(
other.pileupOffsetsSource_[
i]);
212 template <
typename T>
221 typename std::vector<const T*>::const_iterator&
last)
const {
222 first = pileups_.begin();
223 last = pileups_.end();
234 unsigned int bcr = getBunchCrossing(ip) - firstCrossing_;
235 for (
unsigned int i = 0;
i < pileupOffsetsSource_.size() - 1; ++
i) {
236 if (ip >= (pileupOffsetsSource_[
i])[bcr] && ip < (pileupOffsetsSource_[
i + 1])[bcr])
239 return pileupOffsetsSource_.size() - 1;
245 for (
unsigned int ii = 1;
ii < pileupOffsetsBcr_.size();
ii++) {
246 if (ip >= pileupOffsetsBcr_[
ii - 1] && ip < pileupOffsetsBcr_[
ii])
247 return ii + firstCrossing_ - 1;
249 if (ip < pileups_.size())
250 return lastCrossing_;
256 template <
typename T>
265 std::ostream& operator<<(std::ostream& o, const CrossingFrame<T>& cf) {
266 std::pair<int, int>
range = cf.getBunchRange();
267 o <<
"\nCrossingFrame for subdet " << cf.getEventID() <<
", bunchrange = " <<
range.first <<
"," <<
range.second
268 <<
", bunchSpace " << cf.getBunchSpace();
276 shPtrPileupsPCF_ = shPtr;
282 pileups_.push_back(&product);
288 for (
auto const&
item : product) {
289 pileups_.push_back(&
item);
298 for (
unsigned int i = 0;
i < vec->size(); ++
i) {
299 signals_.push_back(&((*vec)[
i]));
307 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 swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
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)