CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
SiStripFedCablingFakeESSource Class Reference

Builds cabling map based on list of DetIds and FedIds read from ascii files. More...

#include <SiStripFedCablingFakeESSource.h>

Inheritance diagram for SiStripFedCablingFakeESSource:
SiStripFedCablingESProducer edm::EventSetupRecordIntervalFinder edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 SiStripFedCablingFakeESSource (const edm::ParameterSet &)
 
 ~SiStripFedCablingFakeESSource () override
 
- Public Member Functions inherited from SiStripFedCablingESProducer
const SiStripFedCablingESProduceroperator= (const SiStripFedCablingESProducer &)=delete
 
virtual std::unique_ptr< SiStripFedCablingproduce (const SiStripFedCablingRcd &)
 
 SiStripFedCablingESProducer (const edm::ParameterSet &)
 
 SiStripFedCablingESProducer (const SiStripFedCablingESProducer &)=delete
 
 ~SiStripFedCablingESProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (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
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (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)
 

Protected Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 
- 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::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 &)
 

Private Member Functions

SiStripFedCablingmake (const SiStripFedCablingRcd &) override
 

Private Attributes

edm::FileInPath fedIds_
 
SiStripDetInfo m_detInfo
 
edm::ParameterSet pset_
 

Additional Inherited Members

- Static Public Member Functions inherited from SiStripFedCablingESProducer
static uint16_t ccuAddr (const uint16_t &nth_module)
 
static uint16_t ccuChan (const uint16_t &nth_module)
 
static uint16_t fecCrate (const uint16_t &nth_module)
 
static uint16_t fecRing (const uint16_t &nth_module)
 
static uint16_t fecSlot (const uint16_t &nth_module)
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- 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 > >>
 

Detailed Description

Builds cabling map based on list of DetIds and FedIds read from ascii files.

Author
R.Bainbridge

Definition at line 18 of file SiStripFedCablingFakeESSource.h.

Constructor & Destructor Documentation

◆ SiStripFedCablingFakeESSource()

SiStripFedCablingFakeESSource::SiStripFedCablingFakeESSource ( const edm::ParameterSet pset)
explicit

Definition at line 19 of file SiStripFedCablingFakeESSource.cc.

References edm::FileInPath::fullPath(), m_detInfo, muonDTDigis_cfi::pset, and SiStripDetInfoFileReader::read().

20  : SiStripFedCablingESProducer(pset), fedIds_(pset.getParameter<edm::FileInPath>("FedIdsFile")), pset_(pset) {
21  findingRecord<SiStripFedCablingRcd>();
22  m_detInfo = SiStripDetInfoFileReader::read(pset.getParameter<edm::FileInPath>("SiStripDetInfoFile").fullPath());
23  edm::LogVerbatim("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
24  << " Constructing object...";
25 }
Log< level::Info, true > LogVerbatim
std::string fullPath() const
Definition: FileInPath.cc:161
SiStripFedCablingESProducer(const edm::ParameterSet &)
SiStripDetInfo read(std::string filePath)

◆ ~SiStripFedCablingFakeESSource()

SiStripFedCablingFakeESSource::~SiStripFedCablingFakeESSource ( )
override

Definition at line 29 of file SiStripFedCablingFakeESSource.cc.

29  {
30  edm::LogVerbatim("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
31  << " Destructing object...";
32 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ make()

SiStripFedCabling * SiStripFedCablingFakeESSource::make ( const SiStripFedCablingRcd )
overrideprivatevirtual

Builds cabling map based on ascii files.

Implements SiStripFedCablingESProducer.

Definition at line 36 of file SiStripFedCablingFakeESSource.cc.

References SiStripFecCabling::addDevices(), generateTowerEtThresholdLUT::addr, SiStripFedCablingESProducer::ccuAddr(), SiStripFedCablingESProducer::ccuChan(), getInfo::conn, SiStripFecCabling::connections(), SiStripFecCabling::countDevices(), SiStripFecCabling::crates(), SiStripFedCablingESProducer::fecCrate(), SiStripFedCablingESProducer::fecRing(), SiStripFedCablingESProducer::fecSlot(), L1TStage2BMTF_cff::fedIds, fedIds_, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, cms::cuda::for(), edm::FileInPath::fullPath(), SiStripDetInfo::getAllDetIds(), SiStripDetInfo::getNumberOfApvsAndStripLength(), edm::ParameterSet::getParameter(), SiStripKey::key(), LogTrace, m_detInfo, sistrip::mlCabling_, NumberOfDevices::print(), pset_, and contentValuesCheck::ss.

36  {
37  edm::LogVerbatim("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
38  << " Building \"fake\" FED cabling map"
39  << " from real DetIds and FedIds (read from ascii file)";
40 
41  // Create FEC cabling object
42  SiStripFecCabling* fec_cabling = new SiStripFecCabling();
43 
44  // Read DetId list from file
45  typedef std::vector<uint32_t> Dets;
46  Dets dets = m_detInfo.getAllDetIds();
47 
48  // Read FedId list from file
49  typedef std::vector<uint16_t> Feds;
51 
52  bool populateAllFeds = pset_.getParameter<bool>("PopulateAllFeds");
53 
54  // Iterator through DetInfo objects and populate FEC cabling object
55  uint32_t imodule = 0;
56  Dets::const_iterator idet = dets.begin();
57  Dets::const_iterator jdet = dets.end();
58  for (; idet != jdet; ++idet) {
59  uint16_t npairs = m_detInfo.getNumberOfApvsAndStripLength(*idet).first / 2;
60  for (uint16_t ipair = 0; ipair < npairs; ++ipair) {
61  uint16_t addr = 0;
62  if (npairs == 2 && ipair == 0) {
63  addr = 32;
64  } else if (npairs == 2 && ipair == 1) {
65  addr = 36;
66  } else if (npairs == 3 && ipair == 0) {
67  addr = 32;
68  } else if (npairs == 3 && ipair == 1) {
69  addr = 34;
70  } else if (npairs == 3 && ipair == 2) {
71  addr = 36;
72  } else {
73  edm::LogWarning("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
74  << " Inconsistent values for nPairs (" << npairs << ") and ipair (" << ipair
75  << ")!";
76  }
77  uint32_t module_key =
78  SiStripFecKey(fecCrate(imodule), fecSlot(imodule), fecRing(imodule), ccuAddr(imodule), ccuChan(imodule)).key();
80  fecSlot(imodule),
81  fecRing(imodule),
82  ccuAddr(imodule),
83  ccuChan(imodule),
84  addr,
85  addr + 1, // apv i2c addresses
86  module_key, // dcu id
87  *idet, // det id
88  npairs); // apv pairs
89  fec_cabling->addDevices(conn);
90  }
91  imodule++;
92  }
93 
94  // Assign "dummy" FED ids/chans
95  bool insufficient = false;
96  Feds::const_iterator ifed = feds.begin();
97  uint16_t fed_ch = 0;
98  for (auto& icrate : fec_cabling->crates()) {
99  for (auto& ifec : icrate.fecs()) {
100  for (auto& iring : ifec.rings()) {
101  for (auto& iccu : iring.ccus()) {
102  for (auto& imod : iccu.modules()) {
103  if (populateAllFeds) {
104  for (uint16_t ipair = 0; ipair < imod.nApvPairs(); ipair++) {
105  if (ifed == feds.end()) {
106  fed_ch++;
107  ifed = feds.begin();
108  }
109  if (fed_ch == 96) {
110  insufficient = true;
111  break;
112  }
113 
114  std::pair<uint16_t, uint16_t> addr = imod.activeApvPair(imod.lldChannel(ipair));
115  SiStripModule::FedChannel fed_channel((*ifed) / 16 + 1, // 16 FEDs per crate, numbering starts from 1
116  (*ifed) % 16 + 2, // FED slot starts from 2
117  *ifed,
118  fed_ch);
119  imod.fedCh(addr.first, fed_channel);
120  ifed++;
121  }
122  } else {
123  // Patch introduced by D.Giordano 2/12/08
124  //to reproduce the fake cabling used in 2x
125  //that was designed to fill each fed iteratively
126  //filling all channels of a fed before going to the next one
127  if (96 - fed_ch < imod.nApvPairs()) {
128  ifed++;
129  fed_ch = 0;
130  } // move to next FED
131  for (uint16_t ipair = 0; ipair < imod.nApvPairs(); ipair++) {
132  std::pair<uint16_t, uint16_t> addr = imod.activeApvPair(imod.lldChannel(ipair));
133  SiStripModule::FedChannel fed_channel((*ifed) / 16 + 1, // 16 FEDs per crate, numbering starts from 1
134  (*ifed) % 16 + 2, // FED slot starts from 2
135  (*ifed),
136  fed_ch);
137  imod.fedCh(addr.first, fed_channel);
138  fed_ch++;
139  }
140  }
141  }
142  }
143  }
144  }
145  }
146 
147  if (insufficient) {
148  edm::LogWarning(mlCabling_) << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
149  << " Insufficient FED channels to cable entire system!";
150  }
151 
152  // Some debug
153  std::stringstream ss;
154  ss << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
155  << " First count devices of FEC cabling " << std::endl;
156  fec_cabling->countDevices().print(ss);
157  LogTrace(mlCabling_) << ss.str();
158 
159  // Build FED cabling using FedChannelConnections
160  std::vector<FedChannelConnection> conns;
161  fec_cabling->connections(conns);
162  SiStripFedCabling* cabling = new SiStripFedCabling(conns);
163 
164  return cabling;
165 }
Log< level::Info, true > LogVerbatim
static uint16_t ccuAddr(const uint16_t &nth_module)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static uint16_t fecCrate(const uint16_t &nth_module)
std::string fullPath() const
Definition: FileInPath.cc:161
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
void addDevices(const FedChannelConnection &conn)
NumberOfDevices countDevices() const
static uint16_t fecSlot(const uint16_t &nth_module)
static uint16_t fecRing(const uint16_t &nth_module)
#define LogTrace(id)
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static const char mlCabling_[]
Class containning control, module, detector and connection information, at the level of a FED channel...
void print(std::stringstream &) const
const uint32_t & key() const
Definition: SiStripKey.h:120
void connections(std::vector< FedChannelConnection > &) const
const std::vector< SiStripFecCrate > & crates() const
static uint16_t ccuChan(const uint16_t &nth_module)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
conn
Definition: getInfo.py:9
Log< level::Warning, false > LogWarning
const std::vector< uint32_t > & getAllDetIds() const noexcept

◆ setIntervalFor()

void SiStripFedCablingFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iov_sync,
edm::ValidityInterval iov_validity 
)
overrideprotectedvirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 169 of file SiStripFedCablingFakeESSource.cc.

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

171  {
172  edm::ValidityInterval infinity(iov_sync.beginOfTime(), iov_sync.endOfTime());
173  iov_validity = infinity;
174 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
const double infinity

Member Data Documentation

◆ fedIds_

edm::FileInPath SiStripFedCablingFakeESSource::fedIds_
private

Location of ascii file containing FedIds.

Definition at line 33 of file SiStripFedCablingFakeESSource.h.

Referenced by make().

◆ m_detInfo

SiStripDetInfo SiStripFedCablingFakeESSource::m_detInfo
private

Definition at line 35 of file SiStripFedCablingFakeESSource.h.

Referenced by make(), and SiStripFedCablingFakeESSource().

◆ pset_

edm::ParameterSet SiStripFedCablingFakeESSource::pset_
private

Definition at line 34 of file SiStripFedCablingFakeESSource.h.

Referenced by make().