CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
66  PmaxNbSources_ = cf.getMaxNbSources();
67  PbunchSpace_ = cf.getBunchSpace();
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();
84  PCFpileupFileNr_ = cf.getPileupFileNr();
85  PCFidFirstPileup_ = cf.getIdFirstPileup();
86  PCFpileupOffsetsBcr_ = cf.getPileupOffsetsBcr();
87  PCFpileupOffsetsSource_ = cf.getPileupOffsetsSource();
88 }
89 
90 template <typename T>
92  // TODO: reduce copy-paste
93  PmaxNbSources_ = cf.getMaxNbSources();
94  PbunchSpace_ = cf.getBunchSpace();
95  firstPCrossing_ = cf.getBunchRange().first;
96  lastPCrossing_ = cf.getBunchRange().second;
97 
98  PCFpileups_ = cf.getPileupRefs();
99 
100  PCFsubdet_ = cf.getSubDet();
101  PCFpileupFileNr_ = cf.getPileupFileNr();
102  PCFidFirstPileup_ = cf.getIdFirstPileup();
103  PCFpileupOffsetsBcr_ = cf.getPileupOffsetsBcr();
104  PCFpileupOffsetsSource_ = cf.getPileupOffsetsSource();
105 }
106 
107 #endif
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
tuple ret
prodAgent to be discontinued
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
Definition: CrossingFrame.h:86
unsigned int PCFpileupFileNr_
const std::vector< T > & getSignals() const
edm::EventID PCFidFirstPileup_
const std::vector< unsigned int > & getPileupOffsetsBcr() const
Definition: CrossingFrame.h:85
unsigned int getMaxNbSources() const
Definition: CrossingFrame.h:81
int getBunchSpace() const
unsigned int getPileupFileNr() const
std::vector< const T * > getPileups() const
unsigned int PmaxNbSources_
std::string getSubDet() const
Definition: CrossingFrame.h:82
edm::EventID getEventID() const
Definition: CrossingFrame.h:78
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:83
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:90
std::vector< unsigned int > PCFpileupOffsetsBcr_
const std::vector< const T * > & getPileups() const
Definition: CrossingFrame.h:89
edm::EventID getIdFirstPileup() const
Definition: CrossingFrame.h:84
const std::vector< unsigned int > & getPileupOffsetsBcr() const
std::pair< int, int > getBunchRange() const
Definition: CrossingFrame.h:79
int getBunchSpace() const
Definition: CrossingFrame.h:80