CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
PPSTimingCalibrationESSource Class Reference
Inheritance diagram for PPSTimingCalibrationESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 PPSTimingCalibrationESSource (const edm::ParameterSet &)
 
edm::ESProducts< std::unique_ptr< PPSTimingCalibration > > produce (const PPSTimingCalibrationRcd &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Types

enum  DetectorType { DetectorType::INVALID = 0, DetectorType::TOTEM_UFSD = 1, DetectorType::PPS_DIAMOND = 2 }
 

Private Member Functions

std::unique_ptr< PPSTimingCalibrationparsePPSDiamondJsonFile () const
 Extract calibration data from JSON file (PPS horizontal diamond) More...
 
std::unique_ptr< PPSTimingCalibrationparseTotemUFSDJsonFile () const
 Extract calibration data from JSON file (TOTEM vertical) More...
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 

Private Attributes

const std::string filename_
 
DetectorType subdetector_
 

Additional Inherited Members

- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Definition at line 34 of file PPSTimingCalibrationESSource.cc.

Member Enumeration Documentation

◆ DetectorType

Enumerator
INVALID 
TOTEM_UFSD 
PPS_DIAMOND 

Definition at line 43 of file PPSTimingCalibrationESSource.cc.

43 { INVALID = 0, TOTEM_UFSD = 1, PPS_DIAMOND = 2 };

Constructor & Destructor Documentation

◆ PPSTimingCalibrationESSource()

PPSTimingCalibrationESSource::PPSTimingCalibrationESSource ( const edm::ParameterSet iConfig)

Definition at line 60 of file PPSTimingCalibrationESSource.cc.

References edm::ESProducer::setWhatProduced().

61  : filename_(iConfig.getParameter<edm::FileInPath>("calibrationFile").fullPath()),
62  subdetector_((DetectorType)iConfig.getParameter<unsigned int>("subDetector")) {
63  setWhatProduced(this);
64  findingRecord<PPSTimingCalibrationRcd>();
65 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string fullPath() const
Definition: FileInPath.cc:161

Member Function Documentation

◆ fillDescriptions()

void PPSTimingCalibrationESSource::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 161 of file PPSTimingCalibrationESSource.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, createfilelist::int, and INVALID.

161  {
163  desc.add<edm::FileInPath>("calibrationFile", edm::FileInPath())
164  ->setComment("file with SAMPIC calibrations, ADC and INL; if empty or corrupted, no calibration will be applied");
165  desc.add<unsigned int>("subDetector", (unsigned int)PPSTimingCalibrationESSource::DetectorType::INVALID)
166  ->setComment("type of sub-detector for which the calibrations are provided");
167 
168  descriptions.add("ppsTimingCalibrationESSource", desc);
169 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ parsePPSDiamondJsonFile()

std::unique_ptr< PPSTimingCalibration > PPSTimingCalibrationESSource::parsePPSDiamondJsonFile ( ) const
private

Extract calibration data from JSON file (PPS horizontal diamond)

Definition at line 126 of file PPSTimingCalibrationESSource.cc.

References filename_, pfMETCorrectionType0_cfi::formula, crabWrapper::key, submitPVValidationJobs::params, AlCaHLTBitMon_QueryRunRegistry::string, hgcalLayerClusters_cfi::timeOffset, and contentValuesCheck::values.

Referenced by produce().

126  {
127  pt::ptree mother_node;
128  pt::read_json(filename_, mother_node);
129 
130  const std::string formula = mother_node.get<std::string>("formula");
133 
134  for (pt::ptree::value_type& par : mother_node.get_child("Parameters.Sectors")) {
136  key.db = par.second.get<int>("sector");
137 
138  for (pt::ptree::value_type& st : par.second.get_child("Stations")) {
139  key.sampic = st.second.get<int>("station");
140 
141  for (pt::ptree::value_type& pl : st.second.get_child("Planes")) {
142  key.channel = pl.second.get<int>("plane");
143 
144  for (pt::ptree::value_type& ch : pl.second.get_child("Channels")) {
145  key.cell = ch.second.get<int>("channel");
146  double timeOffset = ch.second.get<double>("time_offset");
147  double timePrecision = ch.second.get<double>("time_precision");
148  time_info[key] = {timeOffset, timePrecision};
149 
150  std::vector<double> values;
151  for (pt::ptree::value_type& param : ch.second.get_child("param"))
152  values.emplace_back(std::stod(param.second.data(), nullptr));
153  params[key] = values;
154  }
155  }
156  }
157  }
158  return std::make_unique<PPSTimingCalibration>(formula, params, time_info);
159 }
std::map< Key, std::pair< double, double > > TimingMap
Helper structure for indexing calibration data.
std::map< Key, std::vector< double > > ParametersMap

◆ parseTotemUFSDJsonFile()

std::unique_ptr< PPSTimingCalibration > PPSTimingCalibrationESSource::parseTotemUFSDJsonFile ( ) const
private

Extract calibration data from JSON file (TOTEM vertical)

Definition at line 91 of file PPSTimingCalibrationESSource.cc.

References filename_, pfMETCorrectionType0_cfi::formula, createfilelist::int, crabWrapper::key, submitPVValidationJobs::params, AlCaHLTBitMon_QueryRunRegistry::string, hgcalLayerClusters_cfi::timeOffset, and contentValuesCheck::values.

Referenced by produce().

91  {
92  pt::ptree mother_node;
93  pt::read_json(filename_, mother_node);
94 
95  const std::string formula = mother_node.get<std::string>("formula");
98 
99  for (pt::ptree::value_type& par : mother_node.get_child("parameters")) {
101  key.db = (int)strtol(par.first.data(), nullptr, 10);
102 
103  for (pt::ptree::value_type& board : par.second) {
104  key.sampic = board.second.get<int>("sampic");
105  key.channel = board.second.get<int>("channel");
106  double timeOffset = board.second.get<double>("time_offset");
107  double timePrecision = board.second.get<double>("time_precision");
108  key.cell = -1;
109  time_info[key] = {timeOffset, timePrecision};
110 
111  int cell_ct = 0;
112  for (pt::ptree::value_type& cell : board.second.get_child("cells")) {
113  std::vector<double> values;
114  key.cell = cell_ct;
115 
116  for (pt::ptree::value_type& param : cell.second)
117  values.emplace_back(std::stod(param.second.data(), nullptr));
118  params[key] = values;
119  cell_ct++;
120  }
121  }
122  }
123  return std::make_unique<PPSTimingCalibration>(formula, params, time_info);
124 }
std::map< Key, std::pair< double, double > > TimingMap
Helper structure for indexing calibration data.
std::map< Key, std::vector< double > > ParametersMap

◆ produce()

edm::ESProducts< std::unique_ptr< PPSTimingCalibration > > PPSTimingCalibrationESSource::produce ( const PPSTimingCalibrationRcd )

Definition at line 69 of file PPSTimingCalibrationESSource.cc.

References Exception, createfilelist::int, parsePPSDiamondJsonFile(), parseTotemUFSDJsonFile(), PPS_DIAMOND, edm::es::products(), subdetector_, and TOTEM_UFSD.

70  {
71  switch (subdetector_) {
76  default:
77  throw cms::Exception("PPSTimingCalibrationESSource") << "Subdetector " << (int)subdetector_ << " not recognised!";
78  }
79 }
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
Definition: ESProducts.h:128
std::unique_ptr< PPSTimingCalibration > parsePPSDiamondJsonFile() const
Extract calibration data from JSON file (PPS horizontal diamond)
std::unique_ptr< PPSTimingCalibration > parseTotemUFSDJsonFile() const
Extract calibration data from JSON file (TOTEM vertical)

◆ setIntervalFor()

void PPSTimingCalibrationESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 83 of file PPSTimingCalibrationESSource.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().

85  {
87 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88

Member Data Documentation

◆ filename_

const std::string PPSTimingCalibrationESSource::filename_
private

◆ subdetector_

DetectorType PPSTimingCalibrationESSource::subdetector_
private

Definition at line 55 of file PPSTimingCalibrationESSource.cc.

Referenced by produce().