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 #include <ostream>
12 
13 //--------------------------------------------------------------------------
14 
16  if (db == rhs.db) {
17  if (sampic == rhs.sampic) {
18  if (channel == rhs.channel)
19  return cell < rhs.cell;
20  return channel < rhs.channel;
21  }
22  return sampic < rhs.sampic;
23  }
24  return db < rhs.db;
25 }
26 
27 std::ostream& operator<<(std::ostream& os, const PPSTimingCalibration::Key& key) {
28  return os << key.db << " " << key.sampic << " " << key.channel << " " << key.cell;
29 }
30 
31 //--------------------------------------------------------------------------
32 
33 std::vector<double> PPSTimingCalibration::parameters(int key1, int key2, int key3, int key4) const {
34  Key key{key1, key2, key3, key4};
35  auto out = parameters_.find(key);
36  if (out == parameters_.end())
37  return {};
38  return out->second;
39 }
40 
41 double PPSTimingCalibration::timeOffset(int key1, int key2, int key3, int key4) const {
42  Key key{key1, key2, key3, key4};
43  auto out = timeInfo_.find(key);
44  if (out == timeInfo_.end())
45  return 0.;
46  return out->second.first;
47 }
48 
49 double PPSTimingCalibration::timePrecision(int key1, int key2, int key3, int key4) const {
50  Key key{key1, key2, key3, key4};
51  auto out = timeInfo_.find(key);
52  if (out == timeInfo_.end())
53  return 0.;
54  return out->second.second;
55 }
56 
57 std::ostream& operator<<(std::ostream& os, const PPSTimingCalibration& data) {
58  os << "FORMULA: " << data.formula_ << "\nDB SAMPIC CHANNEL CELL PARAMETERS TIME_OFFSET\n";
59  for (const auto& kv : data.parameters_) {
60  os << kv.first << " [";
61  for (size_t i = 0; i < kv.second.size(); ++i)
62  os << (i > 0 ? ", " : "") << kv.second.at(i);
63  const auto& time = data.timeInfo_.at(kv.first);
64  os << "] " << time.first << " " << time.second << "\n";
65  }
66  return os;
67 }
mps_fire.i
i
Definition: mps_fire.py:428
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:56
PPSTimingCalibration::Key::operator<
bool operator<(const Key &rhs) const
Comparison operator.
Definition: PPSTimingCalibration.cc:14
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:40
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:48
PPSTimingCalibration::parameters
std::vector< double > parameters(int key1, int key2, int key3, int key4) const
Definition: PPSTimingCalibration.cc:32
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