CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HGCalMappingESProducer Class Reference

plugin parses the module/cell locator files to produce the indexer records More...

Inheritance diagram for HGCalMappingESProducer:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Member Functions

 HGCalMappingESProducer (const edm::ParameterSet &iConfig)
 
std::shared_ptr< HGCalMappingCellIndexerproduceCellMapIndexer (const HGCalElectronicsMappingRcd &)
 
std::shared_ptr< HGCalMappingModuleIndexerproduceModuleMapIndexer (const HGCalElectronicsMappingRcd &)
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () 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 &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void prepareCellMapperIndexer ()
 
void prepareModuleMapperIndexer ()
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &oValidity) override
 

Private Attributes

HGCalMappingCellIndexer cellIndexer_
 
HGCalMappingModuleIndexer modIndexer_
 
std::map< std::string, hgcal::mappingtools::HGCalEntityListparsedMaps_
 

Additional Inherited Members

- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
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 TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
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::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
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

plugin parses the module/cell locator files to produce the indexer records

Definition at line 22 of file HGCalMappingESProducer.cc.

Constructor & Destructor Documentation

◆ HGCalMappingESProducer()

HGCalMappingESProducer::HGCalMappingESProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 24 of file HGCalMappingESProducer.cc.

References hgcal::mappingtools::HGCalEntityList::buildFrom(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), parsedMaps_, prepareCellMapperIndexer(), prepareModuleMapperIndexer(), produceCellMapIndexer(), produceModuleMapIndexer(), edm::ESProducer::setWhatProduced(), and findQualityFiles::v.

24  {
25  //parse the files and hold the list of entities in memory
26  for (auto v : {"modules", "si", "sipm"}) {
29  pmap.buildFrom(fip.fullPath());
30  parsedMaps_[v] = pmap;
31  }
32 
35 
36  findingRecord<HGCalElectronicsMappingRcd>();
37 
40  }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::map< std::string, hgcal::mappingtools::HGCalEntityList > parsedMaps_
std::string fullPath() const
Definition: FileInPath.cc:161
std::shared_ptr< HGCalMappingModuleIndexer > produceModuleMapIndexer(const HGCalElectronicsMappingRcd &)
std::shared_ptr< HGCalMappingCellIndexer > produceCellMapIndexer(const HGCalElectronicsMappingRcd &)
void buildFrom(std::string url)
builds the entity list from a file

Member Function Documentation

◆ fillDescriptions()

static void HGCalMappingESProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 50 of file HGCalMappingESProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), and submitPVResolutionJobs::desc.

50  {
52  desc.add<edm::FileInPath>("modules")->setComment("module locator file");
53  desc.add<edm::FileInPath>("si")->setComment("file containing the mapping of the readout cells in Si modules");
54  desc.add<edm::FileInPath>("sipm")->setComment(
55  "file containing the mapping of the readout cells in SiPM-on-tile modules");
56  descriptions.addWithDefaultLabel(desc);
57  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ prepareCellMapperIndexer()

void HGCalMappingESProducer::prepareCellMapperIndexer ( )
private

Definition at line 75 of file HGCalMappingESProducer.cc.

References cellIndexer_, parsedMaps_, HGCalMappingCellIndexer::processNewCell(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalMappingCellIndexer::update(), and findQualityFiles::v.

Referenced by HGCalMappingESProducer().

75  {
76  for (auto v : {"si", "sipm"}) {
77  auto& pmap = parsedMaps_[v];
78  const auto& entities = pmap.getEntries();
79  for (auto row : entities) {
80  std::string typecode = pmap.getAttr("Typecode", row);
81  int chip = pmap.getIntAttr("ROC", row);
82  int half = pmap.getIntAttr("HalfROC", row);
83  cellIndexer_.processNewCell(typecode, chip, half);
84  }
85  }
86 
87  // all {hex,tile}board types are loaded finalize the mapping indexer
89 }
std::map< std::string, hgcal::mappingtools::HGCalEntityList > parsedMaps_
void processNewCell(std::string typecode, uint16_t chip, uint16_t half)
HGCalMappingCellIndexer cellIndexer_
void update()
process the current list of type codes handled and updates the dense indexers

◆ prepareModuleMapperIndexer()

void HGCalMappingESProducer::prepareModuleMapperIndexer ( )
private

Definition at line 92 of file HGCalMappingESProducer.cc.

References cellIndexer_, MillePedeFileConverter_cfg::e, PixelSLinkDataInputSource_cfi::fedid, HGCalMappingModuleIndexer::finalize(), HGCalMappingCellIndexer::getEnumFromTypecode(), HGCalMappingCellIndexer::getNErxExpectedFor(), HGCalMappingCellIndexer::getNWordsExpectedFor(), modIndexer_, parsedMaps_, HGCalMappingModuleIndexer::processNewModule(), AlCaHLTBitMon_QueryRunRegistry::string, and findQualityFiles::v.

Referenced by HGCalMappingESProducer().

92  {
93  //default values to assign in case module type has not yet been mapped
94  //a high density module (max possible) will be assigned so that the mapping doesn't block
95  auto defaultTypeCodeIdx = cellIndexer_.getEnumFromTypecode("MH-F");
96  auto typecodeidx = defaultTypeCodeIdx;
97  auto defaultNerx = cellIndexer_.getNErxExpectedFor(defaultTypeCodeIdx);
98  auto nerx = defaultNerx;
99  auto defaultTypeNWords = cellIndexer_.getNWordsExpectedFor(defaultTypeCodeIdx);
100  auto nwords = defaultTypeNWords;
101 
102  auto& pmap = parsedMaps_["modules"];
103  auto& entities = pmap.getEntries();
104  for (auto row : entities) {
105  std::string typecode = pmap.getAttr("typecode", row);
106 
107  if (typecode.find('M') == 0 && typecode.size() > 4)
108  typecode = typecode.substr(0, 4);
109 
110  try {
111  typecodeidx = cellIndexer_.getEnumFromTypecode(typecode);
112  nwords = cellIndexer_.getNWordsExpectedFor(typecode);
113  nerx = cellIndexer_.getNErxExpectedFor(typecode);
114  } catch (cms::Exception& e) {
115  int plane = pmap.getIntAttr("plane", row);
116  int u = pmap.getIntAttr("u", row);
117  int v = pmap.getIntAttr("v", row);
118  edm::LogWarning("HGCalMappingESProducer") << "Exception caught decoding index for typecode=" << typecode
119  << " @ plane=" << plane << " u=" << u << " v=" << v << "\n"
120  << e.what() << "\n"
121  << "===> will assign default (MH-F) which may be inefficient";
122  typecodeidx = defaultTypeCodeIdx;
123  nwords = defaultTypeNWords;
124  nerx = defaultNerx;
125  }
126 
127  int fedid = pmap.getIntAttr("fedid", row);
128  int captureblockidx = pmap.getIntAttr("captureblockidx", row);
129  int econdidx = pmap.getIntAttr("econdidx", row);
130  modIndexer_.processNewModule(fedid, captureblockidx, econdidx, typecodeidx, nerx, nwords);
131  }
132 
134 }
std::map< std::string, hgcal::mappingtools::HGCalEntityList > parsedMaps_
size_t getEnumFromTypecode(std::string typecode) const
gets index given typecode string
HGCalMappingCellIndexer cellIndexer_
void processNewModule(uint32_t fedid, uint16_t captureblockIdx, uint16_t econdIdx, uint32_t typecodeIdx, uint32_t nerx, uint32_t nwords)
for a new module it adds it&#39;s type to the readaout sequence vector if the fed id is not yet existing ...
HGCalMappingModuleIndexer modIndexer_
size_t getNWordsExpectedFor(std::string typecode) const
gets the number of words for a given typecode
Log< level::Warning, false > LogWarning
size_t getNErxExpectedFor(std::string typecode) const
gets the number of e-Rx for a given typecode

◆ produceCellMapIndexer()

std::shared_ptr<HGCalMappingCellIndexer> HGCalMappingESProducer::produceCellMapIndexer ( const HGCalElectronicsMappingRcd )
inline

Definition at line 46 of file HGCalMappingESProducer.cc.

References cellIndexer_.

Referenced by HGCalMappingESProducer().

46  {
47  return std::shared_ptr<HGCalMappingCellIndexer>(&cellIndexer_, edm::do_nothing_deleter());
48  }
HGCalMappingCellIndexer cellIndexer_

◆ produceModuleMapIndexer()

std::shared_ptr<HGCalMappingModuleIndexer> HGCalMappingESProducer::produceModuleMapIndexer ( const HGCalElectronicsMappingRcd )
inline

Definition at line 42 of file HGCalMappingESProducer.cc.

References modIndexer_.

Referenced by HGCalMappingESProducer().

42  {
43  return std::shared_ptr<HGCalMappingModuleIndexer>(&modIndexer_, edm::do_nothing_deleter());
44  }
HGCalMappingModuleIndexer modIndexer_

◆ setIntervalFor()

void HGCalMappingESProducer::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
)
inlineoverrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 60 of file HGCalMappingESProducer.cc.

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

62  {
64  }
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

◆ cellIndexer_

HGCalMappingCellIndexer HGCalMappingESProducer::cellIndexer_
private

◆ modIndexer_

HGCalMappingModuleIndexer HGCalMappingESProducer::modIndexer_
private

◆ parsedMaps_

std::map<std::string, hgcal::mappingtools::HGCalEntityList> HGCalMappingESProducer::parsedMaps_
private