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 char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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 54 of file PPSTimingCalibrationESSource.cc.

Constructor & Destructor Documentation

◆ PPSTimingCalibrationESSource()

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

Definition at line 60 of file PPSTimingCalibrationESSource.cc.

61  : filename_(iConfig.getParameter<edm::FileInPath>("calibrationFile").fullPath()),
62  subdetector_((DetectorType)iConfig.getParameter<unsigned int>("subDetector")) {
63  setWhatProduced(this);
64  findingRecord<PPSTimingCalibrationRcd>();
65 }

References edm::ESProducer::setWhatProduced().

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 161 of file PPSTimingCalibrationESSource.cc.

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 }

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

◆ 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.

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 }

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

Referenced by produce().

◆ 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.

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 }

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

Referenced by produce().

◆ produce()

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

Definition at line 69 of file PPSTimingCalibrationESSource.cc.

70  {
71  switch (subdetector_) {
76  default:
77  throw cms::Exception("PPSTimingCalibrationESSource") << "Subdetector " << (int)subdetector_ << " not recognised!";
78  }
79 }

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

◆ setIntervalFor()

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

Member Data Documentation

◆ filename_

const std::string PPSTimingCalibrationESSource::filename_
private

◆ subdetector_

DetectorType PPSTimingCalibrationESSource::subdetector_
private

Definition at line 66 of file PPSTimingCalibrationESSource.cc.

Referenced by produce().

PPSTimingCalibration::TimingMap
std::map< Key, std::pair< double, double > > TimingMap
Definition: PPSTimingCalibration.h:38
PPSTimingCalibrationESSource::DetectorType::PPS_DIAMOND
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
pfMETCorrectionType0_cfi.formula
formula
Definition: pfMETCorrectionType0_cfi.py:46
PPSTimingCalibration::Key
Helper structure for indexing calibration data.
Definition: PPSTimingCalibration.h:26
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PPSTimingCalibrationESSource::DetectorType::TOTEM_UFSD
PPSTimingCalibration::ParametersMap
std::map< Key, std::vector< double > > ParametersMap
Definition: PPSTimingCalibration.h:37
edm::es::products
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
Definition: ESProducts.h:128
edm::FileInPath
Definition: FileInPath.h:64
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
PPSTimingCalibrationESSource::subdetector_
DetectorType subdetector_
Definition: PPSTimingCalibrationESSource.cc:66
PPSTimingCalibrationESSource::parsePPSDiamondJsonFile
std::unique_ptr< PPSTimingCalibration > parsePPSDiamondJsonFile() const
Extract calibration data from JSON file (PPS horizontal diamond)
Definition: PPSTimingCalibrationESSource.cc:126
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PPSTimingCalibrationESSource::filename_
const std::string filename_
Definition: PPSTimingCalibrationESSource.cc:65
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
createfilelist.int
int
Definition: createfilelist.py:10
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
PPSTimingCalibrationESSource::DetectorType::INVALID
CalibratedDigis_cfi.timeOffset
timeOffset
Definition: CalibratedDigis_cfi.py:23
Exception
Definition: hltDiff.cc:245
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PPSTimingCalibrationESSource::DetectorType
DetectorType
Definition: PPSTimingCalibrationESSource.cc:54
crabWrapper.key
key
Definition: crabWrapper.py:19
PPSTimingCalibrationESSource::parseTotemUFSDJsonFile
std::unique_ptr< PPSTimingCalibration > parseTotemUFSDJsonFile() const
Extract calibration data from JSON file (TOTEM vertical)
Definition: PPSTimingCalibrationESSource.cc:91
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161