CMS 3D CMS Logo

PPSTimingCalibration.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of CTPPS offline software.
4  * Authors:
5  * Filip Dej
6  * Laurent Forthomme
7  *
8  ****************************************************************************/
9 
11 
12 //--------------------------------------------------------------------------
13 
15  if (db == rhs.db) {
16  if (sampic == rhs.sampic) {
17  if (channel == rhs.channel)
18  return cell < rhs.cell;
19  return channel < rhs.channel;
20  }
21  return sampic < rhs.sampic;
22  }
23  return db < rhs.db;
24 }
25 
26 std::ostream& operator<<(std::ostream& os, const PPSTimingCalibration::Key& key) {
27  return os << key.db << " " << key.sampic << " " << key.channel << " " << key.cell;
28 }
29 
30 //--------------------------------------------------------------------------
31 
32 std::vector<double> PPSTimingCalibration::parameters(int key1, int key2, int key3, int key4) const {
33  Key key{key1, key2, key3, key4};
34  auto out = parameters_.find(key);
35  if (out == parameters_.end())
36  return {};
37  return out->second;
38 }
39 
40 double PPSTimingCalibration::timeOffset(int key1, int key2, int key3, int key4) const {
41  Key key{key1, key2, key3, key4};
42  auto out = timeInfo_.find(key);
43  if (out == timeInfo_.end())
44  return 0.;
45  return out->second.first;
46 }
47 
48 double PPSTimingCalibration::timePrecision(int key1, int key2, int key3, int key4) const {
49  Key key{key1, key2, key3, key4};
50  auto out = timeInfo_.find(key);
51  if (out == timeInfo_.end())
52  return 0.;
53  return out->second.second;
54 }
55 
56 std::ostream& operator<<(std::ostream& os, const PPSTimingCalibration& data) {
57  os << "FORMULA: " << data.formula_ << "\nDB SAMPIC CHANNEL CELL PARAMETERS TIME_OFFSET\n";
58  for (const auto& kv : data.parameters_) {
59  os << kv.first << " [";
60  for (size_t i = 0; i < kv.second.size(); ++i)
61  os << (i > 0 ? ", " : "") << kv.second.at(i);
62  const auto& time = data.timeInfo_.at(kv.first);
63  os << "] " << time.first << " " << time.second << "\n";
64  }
65  return os;
66 }
bool operator<(const Key &rhs) const
Comparison operator.
friend std::ostream & operator<<(std::ostream &os, const Key &key)
double timeOffset(int key1, int key2, int key3, int key4=-1) const
std::vector< double > parameters(int key1, int key2, int key3, int key4) const
Helper structure for indexing calibration data.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
double timePrecision(int key1, int key2, int key3, int key4=-1) const