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 }
mps_fire.i
i
Definition: mps_fire.py:355
PPSTimingCalibration::Key::channel
int channel
Definition: PPSTimingCalibration.h:33
PPSTimingCalibration::Key
Helper structure for indexing calibration data.
Definition: PPSTimingCalibration.h:26
PPSTimingCalibration::parameters_
ParametersMap parameters_
Definition: PPSTimingCalibration.h:54
PPSTimingCalibration::Key::sampic
int sampic
Definition: PPSTimingCalibration.h:33
PPSTimingCalibration::operator<<
friend std::ostream & operator<<(std::ostream &os, const PPSTimingCalibration &data)
Definition: PPSTimingCalibration.cc:55
PPSTimingCalibration::Key::operator<
bool operator<(const Key &rhs) const
Comparison operator.
Definition: PPSTimingCalibration.cc:13
PPSTimingCalibration::Key::cell
int cell
Definition: PPSTimingCalibration.h:33
PPSTimingCalibration::timeOffset
double timeOffset(int key1, int key2, int key3, int key4=-1) const
Definition: PPSTimingCalibration.cc:39
PPSTimingCalibration::Key::db
int db
Definition: PPSTimingCalibration.h:33
PPSTimingCalibration::timePrecision
double timePrecision(int key1, int key2, int key3, int key4=-1) const
Definition: PPSTimingCalibration.cc:47
PPSTimingCalibration::parameters
std::vector< double > parameters(int key1, int key2, int key3, int key4) const
Definition: PPSTimingCalibration.cc:31
PPSTimingCalibration::timeInfo_
TimingMap timeInfo_
Definition: PPSTimingCalibration.h:55
PPSTimingCalibration.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
PPSTimingCalibration
Definition: PPSTimingCalibration.h:17
ntuplemaker.time
time
Definition: ntuplemaker.py:310
crabWrapper.key
key
Definition: crabWrapper.py:19