CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
PPSTimingCalibration Class Reference

#include <PPSTimingCalibration.h>

Classes

struct  Key
 Helper structure for indexing calibration data. More...
 

Public Types

using ParametersMap = std::map< Key, std::vector< double > >
 
using TimingMap = std::map< Key, std::pair< double, double > >
 

Public Member Functions

const std::string & formula () const
 
std::vector< double > parameters (int key1, int key2, int key3, int key4) const
 
 PPSTimingCalibration ()=default
 
 PPSTimingCalibration (const std::string &formula, const ParametersMap &params, const TimingMap &timeinfo)
 
double timeOffset (int key1, int key2, int key3, int key4=-1) const
 
double timePrecision (int key1, int key2, int key3, int key4=-1) const
 
 ~PPSTimingCalibration ()=default
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::string formula_
 
ParametersMap parameters_
 
TimingMap timeInfo_
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 
std::ostream & operator<< (std::ostream &os, const PPSTimingCalibration &data)
 

Detailed Description

Definition at line 18 of file PPSTimingCalibration.h.

Member Typedef Documentation

◆ ParametersMap

using PPSTimingCalibration::ParametersMap = std::map<Key, std::vector<double> >

Definition at line 32 of file PPSTimingCalibration.h.

◆ TimingMap

using PPSTimingCalibration::TimingMap = std::map<Key, std::pair<double, double> >

Definition at line 33 of file PPSTimingCalibration.h.

Constructor & Destructor Documentation

◆ PPSTimingCalibration() [1/2]

PPSTimingCalibration::PPSTimingCalibration ( )
default

◆ PPSTimingCalibration() [2/2]

PPSTimingCalibration::PPSTimingCalibration ( const std::string &  formula,
const ParametersMap params,
const TimingMap timeinfo 
)
inline

Definition at line 36 of file PPSTimingCalibration.h.

◆ ~PPSTimingCalibration()

PPSTimingCalibration::~PPSTimingCalibration ( )
default

Member Function Documentation

◆ formula()

const std::string& PPSTimingCalibration::formula ( ) const
inline

◆ parameters()

std::vector< double > PPSTimingCalibration::parameters ( int  key1,
int  key2,
int  key3,
int  key4 
) const

Definition at line 33 of file PPSTimingCalibration.cc.

References crabWrapper::key, MillePedeFileConverter_cfg::out, and parameters_.

Referenced by TotemT2RecHitProducerAlgorithm::build(), CTPPSDiamondRecHitProducerAlgorithm::build(), and TotemTimingConversions::voltSamples().

33  {
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 }

◆ serialize()

template<class Archive >
void PPSTimingCalibration::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ timeOffset()

double PPSTimingCalibration::timeOffset ( int  key1,
int  key2,
int  key3,
int  key4 = -1 
) const

Definition at line 41 of file PPSTimingCalibration.cc.

References crabWrapper::key, MillePedeFileConverter_cfg::out, and timeInfo_.

Referenced by TotemT2RecHitProducerAlgorithm::build(), CTPPSDiamondRecHitProducerAlgorithm::build(), and TotemTimingConversions::timeOfFirstSample().

41  {
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 }

◆ timePrecision()

double PPSTimingCalibration::timePrecision ( int  key1,
int  key2,
int  key3,
int  key4 = -1 
) const

Definition at line 49 of file PPSTimingCalibration.cc.

References crabWrapper::key, MillePedeFileConverter_cfg::out, and timeInfo_.

Referenced by TotemT2RecHitProducerAlgorithm::build(), CTPPSDiamondRecHitProducerAlgorithm::build(), and TotemTimingConversions::timePrecision().

49  {
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 }

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 52 of file PPSTimingCalibration.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 52 of file PPSTimingCalibration.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const PPSTimingCalibration data 
)
friend

Definition at line 57 of file PPSTimingCalibration.cc.

57  {
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 
64  PPSTimingCalibration::Key key = kv.first;
65  if (data.timeInfo_.find(key) == data.timeInfo_.end())
66  key = {kv.first.db, kv.first.sampic, kv.first.channel, -1};
67 
68  const auto& time = data.timeInfo_.at(key);
69  os << "] " << time.first << " " << time.second << "\n";
70  }
71  return os;
72 }
Helper structure for indexing calibration data.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

Member Data Documentation

◆ formula_

std::string PPSTimingCalibration::formula_
private

Definition at line 48 of file PPSTimingCalibration.h.

Referenced by formula().

◆ parameters_

ParametersMap PPSTimingCalibration::parameters_
private

◆ timeInfo_

TimingMap PPSTimingCalibration::timeInfo_
private

Definition at line 50 of file PPSTimingCalibration.h.

Referenced by timeOffset(), and timePrecision().