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 {
19 
20  public:
21 
24 
26 
28 
29  // getters for data members of PCrossingFrame
30  edm::EventID getEventID() const {return Pid_;}
31  const std::vector<T>& getSignals() const { return PCFsignals_; }
32  const std::vector<T>& getPileupRefs() const { return PCFpileups_; }
33  std::vector<const T *> getPileups() const {
34  std::vector<const T *> ret;
35  ret.reserve(PCFpileups_.size());
36  for(const auto& p: PCFpileups_) ret.emplace_back(&p);
37  return ret;
38  }
39  int getBunchSpace() const {return PbunchSpace_;}
40  unsigned int getMaxNbSources() const {return PmaxNbSources_; }
41  std::string getSubDet() const { return PCFsubdet_;}
42  unsigned int getPileupFileNr() const {return PCFpileupFileNr_;}
44  const std::vector<unsigned int>& getPileupOffsetsBcr() const {return PCFpileupOffsetsBcr_;}
45  const std::vector< std::vector<unsigned int> >& getPileupOffsetsSource() const {return PCFpileupOffsetsSource_;} //one per source
46  std::pair<int,int> getBunchRange() const {return std::pair<int,int>(firstPCrossing_,lastPCrossing_);}
47 
48 
49  private:
50  unsigned int PmaxNbSources_;
55  std::vector<T> PCFpileups_;
56  std::vector<T> PCFsignals_;
58  unsigned int PCFpileupFileNr_;
60  std::vector<unsigned int> PCFpileupOffsetsBcr_;
61  std::vector< std::vector<unsigned int> > PCFpileupOffsetsSource_;
62 };
63 
64 
65 template <class T>
67 {
68  //get data members from CrossingFrame
71  Pid_ = cf.getEventID();
72  firstPCrossing_ = cf.getBunchRange().first;
73  lastPCrossing_ = cf.getBunchRange().second;
74 
75  const auto& pileups = cf.getPileups();
76  PCFpileups_.reserve(pileups.size());
77  for(const auto& ptr: pileups) {
78  PCFpileups_.emplace_back(*ptr);
79  }
80  const auto& signal = cf.getSignal();
81  PCFsignals_.reserve(signal.size());
82  for(const auto& ptr: signal) {
83  PCFsignals_.emplace_back(*ptr);
84  }
85 
86  PCFsubdet_ = cf.getSubDet();
91 }
92 
93 template <typename T>
95  // TODO: reduce copy-paste
98  firstPCrossing_ = cf.getBunchRange().first;
99  lastPCrossing_ = cf.getBunchRange().second;
100 
101  PCFpileups_ = cf.getPileupRefs();
102 
103  PCFsubdet_ = cf.getSubDet();
108 }
109 
110 
111 #endif
unsigned int PCFpileupFileNr_
const std::vector< T > & getSignals() const
std::pair< int, int > getBunchRange() const
Definition: CrossingFrame.h:88
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
std::vector< std::vector< unsigned int > > PCFpileupOffsetsSource_
edm::EventID PCFidFirstPileup_
const std::vector< unsigned int > & getPileupOffsetsBcr() const
Definition: CrossingFrame.h:94
unsigned int getMaxNbSources() const
Definition: CrossingFrame.h:90
int getBunchSpace() const
unsigned int getPileupFileNr() const
unsigned int PmaxNbSources_
std::string getSubDet() const
Definition: CrossingFrame.h:91
edm::EventID getEventID() const
Definition: CrossingFrame.h:87
edm::EventID getIdFirstPileup() const
edm::EventID getEventID() const
std::vector< T > PCFsignals_
const std::vector< T > & getPileupRefs() const
const std::vector< std::vector< unsigned int > > & getPileupOffsetsSource() const
Definition: CrossingFrame.h:95
const std::vector< const T * > & getPileups() const
Definition: CrossingFrame.h:96
const std::vector< const T * > & getSignal() const
Definition: CrossingFrame.h:97
edm::EventID Pid_
unsigned int getPileupFileNr() const
Definition: CrossingFrame.h:92
void setAllExceptSignalFrom(const PCrossingFrame< T > &cf)
std::vector< T > PCFpileups_
std::string getSubDet() const
unsigned int getMaxNbSources() const
std::pair< int, int > getBunchRange() const
std::string PCFsubdet_
std::vector< unsigned int > PCFpileupOffsetsBcr_
std::vector< const T * > getPileups() const
edm::EventID getIdFirstPileup() const
Definition: CrossingFrame.h:93
const std::vector< unsigned int > & getPileupOffsetsBcr() const
int getBunchSpace() const
Definition: CrossingFrame.h:89