CMS 3D CMS Logo

PCrossingFrame.h
Go to the documentation of this file.
1 #ifndef PCROSSING_FRAME_H
2 #define PCROSSING_FRAME_H
3 
15 
16 template <class T>
17 class PCrossingFrame {
18 public:
21 
23 
25 
26  // getters for data members of PCrossingFrame
27  edm::EventID getEventID() const { return Pid_; }
28  const std::vector<T>& getSignals() const { return PCFsignals_; }
29  const std::vector<T>& getPileupRefs() const { return PCFpileups_; }
30  std::vector<const T*> getPileups() const {
31  std::vector<const T*> ret;
32  ret.reserve(PCFpileups_.size());
33  for (const auto& p : PCFpileups_)
34  ret.emplace_back(&p);
35  return ret;
36  }
37  int getBunchSpace() const { return PbunchSpace_; }
38  unsigned int getMaxNbSources() const { return PmaxNbSources_; }
39  std::string getSubDet() const { return PCFsubdet_; }
40  unsigned int getPileupFileNr() const { return PCFpileupFileNr_; }
42  const std::vector<unsigned int>& getPileupOffsetsBcr() const { return PCFpileupOffsetsBcr_; }
43  const std::vector<std::vector<unsigned int> >& getPileupOffsetsSource() const {
45  } //one per source
46  std::pair<int, int> getBunchRange() const { return std::pair<int, int>(firstPCrossing_, lastPCrossing_); }
47 
48 private:
49  unsigned int PmaxNbSources_;
54  std::vector<T> PCFpileups_;
55  std::vector<T> PCFsignals_;
57  unsigned int PCFpileupFileNr_;
59  std::vector<unsigned int> PCFpileupOffsetsBcr_;
60  std::vector<std::vector<unsigned int> > PCFpileupOffsetsSource_;
61 };
62 
63 template <class T>
65  //get data members from CrossingFrame
68  Pid_ = cf.getEventID();
69  firstPCrossing_ = cf.getBunchRange().first;
70  lastPCrossing_ = cf.getBunchRange().second;
71 
72  const auto& pileups = cf.getPileups();
73  PCFpileups_.reserve(pileups.size());
74  for (const auto& ptr : pileups) {
75  PCFpileups_.emplace_back(*ptr);
76  }
77  const auto& signal = cf.getSignal();
78  PCFsignals_.reserve(signal.size());
79  for (const auto& ptr : signal) {
80  PCFsignals_.emplace_back(*ptr);
81  }
82 
83  PCFsubdet_ = cf.getSubDet();
88 }
89 
90 template <typename T>
92  // TODO: reduce copy-paste
95  firstPCrossing_ = cf.getBunchRange().first;
96  lastPCrossing_ = cf.getBunchRange().second;
97 
99 
100  PCFsubdet_ = cf.getSubDet();
105 }
106 
107 #endif
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
Definition: CrossingFrame.h:87
unsigned int PCFpileupFileNr_
const std::vector< T > & getSignals() const
edm::EventID PCFidFirstPileup_
const std::vector< unsigned int > & getPileupOffsetsBcr() const
Definition: CrossingFrame.h:86
unsigned int getMaxNbSources() const
Definition: CrossingFrame.h:82
int getBunchSpace() const
unsigned int getPileupFileNr() const
std::vector< const T * > getPileups() const
unsigned int PmaxNbSources_
std::string getSubDet() const
Definition: CrossingFrame.h:83
edm::EventID getEventID() const
Definition: CrossingFrame.h:79
edm::EventID getIdFirstPileup() const
edm::EventID getEventID() const
std::vector< T > PCFsignals_
const std::vector< T > & getPileupRefs() const
edm::EventID Pid_
unsigned int getPileupFileNr() const
Definition: CrossingFrame.h:84
void setAllExceptSignalFrom(const PCrossingFrame< T > &cf)
std::vector< T > PCFpileups_
std::string getSubDet() const
std::vector< std::vector< unsigned int > > PCFpileupOffsetsSource_
unsigned int getMaxNbSources() const
std::pair< int, int > getBunchRange() const
std::string PCFsubdet_
const std::vector< const T * > & getSignal() const
Definition: CrossingFrame.h:91
std::vector< unsigned int > PCFpileupOffsetsBcr_
const std::vector< const T * > & getPileups() const
Definition: CrossingFrame.h:90
edm::EventID getIdFirstPileup() const
Definition: CrossingFrame.h:85
const std::vector< unsigned int > & getPileupOffsetsBcr() const
std::pair< int, int > getBunchRange() const
Definition: CrossingFrame.h:80
int getBunchSpace() const
Definition: CrossingFrame.h:81