CMS 3D CMS Logo

LHCInfoCombined.h
Go to the documentation of this file.
1 #ifndef CondTools_RunInfo_LHCInfoCombined_H
2 #define CondTools_RunInfo_LHCInfoCombined_H
3 
6 
10 
14 
15 #include <bitset>
16 #include <iostream>
17 #include <string>
18 #include <sstream>
19 #include <vector>
20 
22 public:
23  LHCInfoCombined() = default;
24 
25  LHCInfoCombined(const LHCInfo& lhcInfo);
26  LHCInfoCombined(const LHCInfoPerLS& infoPerLS, const LHCInfoPerFill& infoPerFill);
27  LHCInfoCombined(const edm::EventSetup& iSetup,
30  const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo,
31  bool useNewLHCInfo);
32 
33  //this factory method is necessary because constructor can't be a template
34  template <class RecordT, class ListT>
39  const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo,
40  bool useNewLHCInfo);
41 
42  void setFromLHCInfo(const LHCInfo& lhcInfo);
43  void setFromPerLS(const LHCInfoPerLS& infoPerLS);
44  void setFromPerFill(const LHCInfoPerFill& infoPerFill);
45 
46  float crossingAngle() const;
47  static constexpr float crossingAngleInvalid = -1.;
49 
52  float betaStarX;
53  float betaStarY;
54  float energy;
55  unsigned short fillNumber;
56 
57  void print(std::ostream& os) const;
58 };
59 
60 std::ostream& operator<<(std::ostream& os, LHCInfoCombined beamInfo);
61 
62 template <class RecordT, class ListT>
67  const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo,
68  bool useNewLHCInfo) {
69  LHCInfoCombined lhcInfoCombined;
70  if (useNewLHCInfo) {
71  LHCInfoPerLS const& lhcInfoPerLS = iRecord.get(tokenInfoPerLS);
72  LHCInfoPerFill const& lhcInfoPerFill = iRecord.get(tokenInfoPerFill);
73  lhcInfoCombined.setFromPerLS(lhcInfoPerLS);
74  lhcInfoCombined.setFromPerFill(lhcInfoPerFill);
75  } else {
76  LHCInfo const& lhcInfo = iRecord.get(tokenInfo);
77  lhcInfoCombined.setFromLHCInfo(lhcInfo);
78  }
79  return lhcInfoCombined;
80 }
81 
82 #endif // CondTools_RunInfo_LHCInfoCombined_H
void setFromPerLS(const LHCInfoPerLS &infoPerLS)
float crossingAngle() const
void setFromPerFill(const LHCInfoPerFill &infoPerFill)
bool isCrossingAngleInvalid()
std::ostream & operator<<(std::ostream &os, LHCInfoCombined beamInfo)
static constexpr float crossingAngleInvalid
void setFromLHCInfo(const LHCInfo &lhcInfo)
LHCInfoCombined()=default
void print(std::ostream &os) const
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
unsigned short fillNumber
static LHCInfoCombined createLHCInfoCombined(const edm::eventsetup::DependentRecordImplementation< RecordT, ListT > &iRecord, const edm::ESGetToken< LHCInfoPerLS, LHCInfoPerLSRcd > &tokenInfoPerLS, const edm::ESGetToken< LHCInfoPerFill, LHCInfoPerFillRcd > &tokenInfoPerFill, const edm::ESGetToken< LHCInfo, LHCInfoRcd > &tokenInfo, bool useNewLHCInfo)