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 ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
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
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
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

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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={})
 
- 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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- 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

Enumerator
INVALID 
TOTEM_UFSD 
PPS_DIAMOND 

Definition at line 44 of file PPSTimingCalibrationESSource.cc.

45  {
46  INVALID = 0,
47  TOTEM_UFSD = 1,
48  PPS_DIAMOND = 2
49  };

Constructor & Destructor Documentation

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

Definition at line 64 of file PPSTimingCalibrationESSource.cc.

References edm::ESProducer::setWhatProduced().

64  :
65  filename_ ( iConfig.getParameter<edm::FileInPath>( "calibrationFile" ).fullPath() ),
66  subdetector_( (DetectorType)iConfig.getParameter<unsigned int>( "subDetector" ) )
67 {
68  setWhatProduced( this );
69  findingRecord<PPSTimingCalibrationRcd>();
70 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
std::string fullPath() const
Definition: FileInPath.cc:163

Member Function Documentation

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

Definition at line 175 of file PPSTimingCalibrationESSource.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_EVENTSETUP_SOURCE, createfilelist::int, INVALID, and edm::ParameterDescriptionNode::setComment().

176 {
178  desc.add<edm::FileInPath>( "calibrationFile", edm::FileInPath() )
179  ->setComment( "file with SAMPIC calibrations, ADC and INL; if empty or corrupted, no calibration will be applied" );
180  desc.add<unsigned int>( "subDetector", (unsigned int)PPSTimingCalibrationESSource::DetectorType::INVALID )
181  ->setComment( "type of sub-detector for which the calibrations are provided" );
182 
183  descriptions.add( "ppsTimingCalibrationESSource", desc );
184 }
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< PPSTimingCalibration > PPSTimingCalibrationESSource::parsePPSDiamondJsonFile ( ) const
private

Extract calibration data from JSON file (PPS horizontal diamond)

Definition at line 138 of file PPSTimingCalibrationESSource.cc.

References PPSTimingCalibration::Key::cell, PPSTimingCalibration::Key::channel, PPSTimingCalibration::Key::db, filename_, EcalElecEmulTccOnlyExample_cfg::formula, crabWrapper::key, nullptr, PPSTimingCalibration::Key::sampic, AlCaHLTBitMon_QueryRunRegistry::string, hgcalLayerClusters_cff::timeOffset, and MuonErrorMatrixValues_cff::values.

Referenced by produce().

139 {
140  pt::ptree mother_node;
141  pt::read_json( filename_, mother_node );
142 
143  const std::string formula = mother_node.get<std::string>( "formula" );
146 
147  for ( pt::ptree::value_type& par : mother_node.get_child( "Parameters.Sectors" ) ) {
149  key.db = par.second.get<int>( "sector" );
150 
151  for ( pt::ptree::value_type& st : par.second.get_child( "Stations" ) ) {
152  key.sampic = st.second.get<int>( "station" );
153 
154  for ( pt::ptree::value_type& pl : st.second.get_child( "Planes" ) ) {
155  key.channel = pl.second.get<int>( "plane" );
156 
157  for ( pt::ptree::value_type& ch : pl.second.get_child( "Channels" ) ) {
158  key.cell = ch.second.get<int>( "channel" );
159  double timeOffset = ch.second.get<double>( "time_offset" );
160  double timePrecision = ch.second.get<double>( "time_precision" );
161  time_info[key] = { timeOffset, timePrecision };
162 
163  std::vector<double> values;
164  for ( pt::ptree::value_type& param : ch.second.get_child( "param" ) )
165  values.emplace_back( std::stod( param.second.data(), nullptr ) );
166  params[key] = values;
167  }
168  }
169  }
170  }
171  return std::make_unique<PPSTimingCalibration>( formula, params, time_info );
172 }
std::map< Key, std::pair< double, double > > TimingMap
#define nullptr
std::map< Key, std::vector< double > > ParametersMap
Helper structure for indexing calibration data.
std::unique_ptr< PPSTimingCalibration > PPSTimingCalibrationESSource::parseTotemUFSDJsonFile ( ) const
private

Extract calibration data from JSON file (TOTEM vertical)

Definition at line 101 of file PPSTimingCalibrationESSource.cc.

References PPSTimingCalibration::Key::cell, PPSTimingCalibration::Key::channel, PPSTimingCalibration::Key::db, filename_, EcalElecEmulTccOnlyExample_cfg::formula, createfilelist::int, crabWrapper::key, nullptr, PPSTimingCalibration::Key::sampic, AlCaHLTBitMon_QueryRunRegistry::string, hgcalLayerClusters_cff::timeOffset, and MuonErrorMatrixValues_cff::values.

Referenced by produce().

102 {
103  pt::ptree mother_node;
104  pt::read_json( filename_, mother_node );
105 
106  const std::string formula = mother_node.get<std::string>( "formula" );
109 
110  for ( pt::ptree::value_type& par : mother_node.get_child( "parameters" ) ) {
112  key.db = (int)strtol( par.first.data(), nullptr, 10 );
113 
114  for ( pt::ptree::value_type& board : par.second ) {
115  key.sampic = board.second.get<int>( "sampic" );
116  key.channel = board.second.get<int>( "channel" );
117  double timeOffset = board.second.get<double>( "time_offset" );
118  double timePrecision = board.second.get<double>( "time_precision" );
119  key.cell = -1;
120  time_info[key] = { timeOffset, timePrecision };
121 
122  int cell_ct = 0;
123  for ( pt::ptree::value_type& cell : board.second.get_child( "cells" ) ) {
124  std::vector<double> values;
125  key.cell = cell_ct;
126 
127  for ( pt::ptree::value_type& param : cell.second )
128  values.emplace_back( std::stod( param.second.data(), nullptr ) );
129  params[key] = values;
130  cell_ct++;
131  }
132  }
133  }
134  return std::make_unique<PPSTimingCalibration>( formula, params, time_info );
135 }
std::map< Key, std::pair< double, double > > TimingMap
#define nullptr
std::map< Key, std::vector< double > > ParametersMap
Helper structure for indexing calibration data.
edm::ESProducts< std::unique_ptr< PPSTimingCalibration > > PPSTimingCalibrationESSource::produce ( const PPSTimingCalibrationRcd )

Definition at line 75 of file PPSTimingCalibrationESSource.cc.

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

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

76 {
77  switch ( subdetector_ ) {
82  default:
83  throw cms::Exception( "PPSTimingCalibrationESSource" )
84  << "Subdetector " << (int)subdetector_ << " not recognised!";
85  }
86 }
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)
void PPSTimingCalibrationESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 91 of file PPSTimingCalibrationESSource.cc.

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

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

Member Data Documentation

const std::string PPSTimingCalibrationESSource::filename_
private
DetectorType PPSTimingCalibrationESSource::subdetector_
private

Definition at line 59 of file PPSTimingCalibrationESSource.cc.

Referenced by produce().