CMS 3D CMS Logo

LHCInfoCombined.cc
Go to the documentation of this file.
3 
5 
6 LHCInfoCombined::LHCInfoCombined(const LHCInfoPerLS& infoPerLS, const LHCInfoPerFill& infoPerFill) {
7  setFromPerLS(infoPerLS);
8  setFromPerFill(infoPerFill);
9 }
10 
14  const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo,
15  bool useNewLHCInfo) {
16  if (useNewLHCInfo) {
17  edm::ESHandle<LHCInfoPerLS> hLHCInfoPerLS = iSetup.getHandle(tokenInfoPerLS);
18  edm::ESHandle<LHCInfoPerFill> hLHCInfoFill = iSetup.getHandle(tokenInfoPerFill);
19  setFromPerLS(*hLHCInfoPerLS);
20  setFromPerFill(*hLHCInfoFill);
21  } else {
22  edm::ESHandle<LHCInfo> hLHCInfo = iSetup.getHandle(tokenInfo);
23  setFromLHCInfo(*hLHCInfo);
24  }
25 }
26 
28  crossingAngleX = lhcInfo.crossingAngle();
29  crossingAngleY = 0;
30  betaStarX = lhcInfo.betaStar();
31  betaStarY = lhcInfo.betaStar();
32  energy = lhcInfo.energy();
33  fillNumber = lhcInfo.fillNumber();
34 }
36  crossingAngleX = infoPerLS.crossingAngleX();
37  crossingAngleY = infoPerLS.crossingAngleY();
38  betaStarX = infoPerLS.betaStarX();
39  betaStarY = infoPerLS.betaStarY();
40 }
42  energy = infoPerFill.energy();
43  fillNumber = infoPerFill.fillNumber();
44 }
45 
47  if (crossingAngleX == 0. && crossingAngleY == 0.) {
48  return crossingAngleInvalid;
49  }
50  if (crossingAngleX != 0. && crossingAngleY != 0.) {
51  edm::LogWarning("LHCInfoCombined") << "crossingAngleX and crossingAngleY are both different from 0";
52  return crossingAngleInvalid;
53  }
55 }
56 
57 //Comparison with the -1 value from LHC when crossing angle is not set
59  float comparisonTolerance = 1e-6;
60  return fabs(crossingAngle() - crossingAngleInvalid) <= comparisonTolerance;
61 }
62 
63 void LHCInfoCombined::print(std::ostream& os) const {
64  os << "Crossing angle x (urad): " << crossingAngleX << std::endl
65  << "Crossing angle y (urad): " << crossingAngleY << std::endl
66  << "Beta star x (m): " << betaStarX << std::endl
67  << "Beta star y (m): " << betaStarY << std::endl
68  << "Energy (GeV): " << energy << std::endl;
69 }
70 
71 std::ostream& operator<<(std::ostream& os, LHCInfoCombined beamInfo) {
72  beamInfo.print(os);
73  return os;
74 }
std::ostream & operator<<(std::ostream &os, LHCInfoCombined beamInfo)
void setFromPerLS(const LHCInfoPerLS &infoPerLS)
void setFromPerFill(const LHCInfoPerFill &infoPerFill)
bool isCrossingAngleInvalid()
float const energy() const
Definition: LHCInfo.cc:190
static constexpr float crossingAngleInvalid
unsigned short const fillNumber() const
Definition: LHCInfo.cc:158
float const betaStarY() const
Definition: LHCInfoPerLS.cc:21
void setFromLHCInfo(const LHCInfo &lhcInfo)
float const crossingAngleX() const
Definition: LHCInfoPerLS.cc:15
float const betaStar() const
Definition: LHCInfo.cc:184
float const energy() const
float const crossingAngle() const
Definition: LHCInfo.cc:182
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
float const crossingAngleY() const
Definition: LHCInfoPerLS.cc:17
LHCInfoCombined()=default
unsigned short const fillNumber() const
void print(std::ostream &os) const
Log< level::Warning, false > LogWarning
float const betaStarX() const
Definition: LHCInfoPerLS.cc:19
unsigned short fillNumber