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