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
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
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
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={})
 
- 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_
 
SiStripDetInfoFileReader m_detInfoFileReader
 
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 18 of file SiStripFedCablingFakeESSource.cc.

19  : SiStripFedCablingESProducer(pset), fedIds_(pset.getParameter<edm::FileInPath>("FedIdsFile")), pset_(pset) {
20  findingRecord<SiStripFedCablingRcd>();
21  m_detInfoFileReader = SiStripDetInfoFileReader{pset.getParameter<edm::FileInPath>("SiStripDetInfoFile").fullPath()};
22  edm::LogVerbatim("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
23  << " Constructing object...";
24 }

References contentValuesFiles::fullPath, m_detInfoFileReader, and muonDTDigis_cfi::pset.

◆ ~SiStripFedCablingFakeESSource()

SiStripFedCablingFakeESSource::~SiStripFedCablingFakeESSource ( )
override

Definition at line 28 of file SiStripFedCablingFakeESSource.cc.

28  {
29  edm::LogVerbatim("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
30  << " Destructing object...";
31 }

Member Function Documentation

◆ make()

SiStripFedCabling * SiStripFedCablingFakeESSource::make ( const SiStripFedCablingRcd )
overrideprivatevirtual

Builds cabling map based on ascii files.

Implements SiStripFedCablingESProducer.

Definition at line 35 of file SiStripFedCablingFakeESSource.cc.

35  {
36  edm::LogVerbatim("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
37  << " Building \"fake\" FED cabling map"
38  << " from real DetIds and FedIds (read from ascii file)";
39 
40  // Create FEC cabling object
41  SiStripFecCabling* fec_cabling = new SiStripFecCabling();
42 
43  // Read DetId list from file
44  typedef std::vector<uint32_t> Dets;
46 
47  // Read FedId list from file
48  typedef std::vector<uint16_t> Feds;
50 
51  bool populateAllFeds = pset_.getParameter<bool>("PopulateAllFeds");
52 
53  // Iterator through DetInfo objects and populate FEC cabling object
54  uint32_t imodule = 0;
55  Dets::const_iterator idet = dets.begin();
56  Dets::const_iterator jdet = dets.end();
57  for (; idet != jdet; ++idet) {
58  uint16_t npairs = m_detInfoFileReader.getNumberOfApvsAndStripLength(*idet).first / 2;
59  for (uint16_t ipair = 0; ipair < npairs; ++ipair) {
60  uint16_t addr = 0;
61  if (npairs == 2 && ipair == 0) {
62  addr = 32;
63  } else if (npairs == 2 && ipair == 1) {
64  addr = 36;
65  } else if (npairs == 3 && ipair == 0) {
66  addr = 32;
67  } else if (npairs == 3 && ipair == 1) {
68  addr = 34;
69  } else if (npairs == 3 && ipair == 2) {
70  addr = 36;
71  } else {
72  edm::LogWarning("FedCabling") << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
73  << " Inconsistent values for nPairs (" << npairs << ") and ipair (" << ipair
74  << ")!";
75  }
76  uint32_t module_key =
77  SiStripFecKey(fecCrate(imodule), fecSlot(imodule), fecRing(imodule), ccuAddr(imodule), ccuChan(imodule)).key();
79  fecSlot(imodule),
80  fecRing(imodule),
81  ccuAddr(imodule),
82  ccuChan(imodule),
83  addr,
84  addr + 1, // apv i2c addresses
85  module_key, // dcu id
86  *idet, // det id
87  npairs); // apv pairs
88  fec_cabling->addDevices(conn);
89  }
90  imodule++;
91  }
92 
93  // Assign "dummy" FED ids/chans
94  bool insufficient = false;
95  Feds::const_iterator ifed = feds.begin();
96  uint16_t fed_ch = 0;
97  for (std::vector<SiStripFecCrate>::const_iterator icrate = fec_cabling->crates().begin();
98  icrate != fec_cabling->crates().end();
99  icrate++) {
100  for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++) {
101  for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
102  iring++) {
103  for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
104  iccu++) {
105  for (std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end();
106  imod++) {
107  if (populateAllFeds) {
108  for (uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++) {
109  if (ifed == feds.end()) {
110  fed_ch++;
111  ifed = feds.begin();
112  }
113  if (fed_ch == 96) {
114  insufficient = true;
115  break;
116  }
117 
118  std::pair<uint16_t, uint16_t> addr = imod->activeApvPair(imod->lldChannel(ipair));
119  SiStripModule::FedChannel fed_channel((*ifed) / 16 + 1, // 16 FEDs per crate, numbering starts from 1
120  (*ifed) % 16 + 2, // FED slot starts from 2
121  *ifed,
122  fed_ch);
123  const_cast<SiStripModule&>(*imod).fedCh(addr.first, fed_channel);
124  ifed++;
125  }
126  } else {
127  // Patch introduced by D.Giordano 2/12/08
128  //to reproduce the fake cabling used in 2x
129  //that was designed to fill each fed iteratively
130  //filling all channels of a fed before going to the next one
131  if (96 - fed_ch < imod->nApvPairs()) {
132  ifed++;
133  fed_ch = 0;
134  } // move to next FED
135  for (uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++) {
136  std::pair<uint16_t, uint16_t> addr = imod->activeApvPair((*imod).lldChannel(ipair));
137  SiStripModule::FedChannel fed_channel((*ifed) / 16 + 1, // 16 FEDs per crate, numbering starts from 1
138  (*ifed) % 16 + 2, // FED slot starts from 2
139  (*ifed),
140  fed_ch);
141  const_cast<SiStripModule&>(*imod).fedCh(addr.first, fed_channel);
142  fed_ch++;
143  }
144  }
145  }
146  }
147  }
148  }
149  }
150 
151  if (insufficient) {
152  edm::LogWarning(mlCabling_) << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
153  << " Insufficient FED channels to cable entire system!";
154  }
155 
156  // Some debug
157  std::stringstream ss;
158  ss << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
159  << " First count devices of FEC cabling " << std::endl;
160  fec_cabling->countDevices().print(ss);
161  LogTrace(mlCabling_) << ss.str();
162 
163  // Build FED cabling using FedChannelConnections
164  std::vector<FedChannelConnection> conns;
165  fec_cabling->connections(conns);
166  SiStripFedCabling* cabling = new SiStripFedCabling(conns);
167 
168  return cabling;
169 }

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

◆ 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 173 of file SiStripFedCablingFakeESSource.cc.

175  {
176  edm::ValidityInterval infinity(iov_sync.beginOfTime(), iov_sync.endOfTime());
177  iov_validity = infinity;
178 }

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), and 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_detInfoFileReader

SiStripDetInfoFileReader SiStripFedCablingFakeESSource::m_detInfoFileReader
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().

l1tstage2emulator_dqm_sourceclient-live_cfg.feds
feds
Definition: l1tstage2emulator_dqm_sourceclient-live_cfg.py:146
SiStripFecCabling
Definition: SiStripFecCabling.h:24
SiStripFedCablingFakeESSource::fedIds_
edm::FileInPath fedIds_
Definition: SiStripFedCablingFakeESSource.h:33
SiStripFecCabling::addDevices
void addDevices(const FedChannelConnection &conn)
Definition: SiStripFecCabling.cc:61
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
edm::ValidityInterval
Definition: ValidityInterval.h:28
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
NumberOfDevices::print
void print(std::stringstream &) const
Definition: NumberOfDevices.cc:34
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
SiStripFedCablingESProducer::ccuChan
static uint16_t ccuChan(const uint16_t &nth_module)
Definition: SiStripFedCablingESProducer.h:48
SiStripFecCabling::countDevices
NumberOfDevices countDevices() const
Definition: SiStripFecCabling.cc:219
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:30
SiStripFedCablingESProducer::SiStripFedCablingESProducer
SiStripFedCablingESProducer(const edm::ParameterSet &)
Definition: SiStripFedCablingESProducer.cc:12
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::FileInPath
Definition: FileInPath.h:64
SiStripFedIdListReader
Definition: SiStripFedIdListReader.h:18
generateTowerEtThresholdLUT.addr
addr
Definition: generateTowerEtThresholdLUT.py:57
SiStripFedCablingESProducer::ccuAddr
static uint16_t ccuAddr(const uint16_t &nth_module)
Definition: SiStripFedCablingESProducer.h:47
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
SiStripFedCablingFakeESSource::m_detInfoFileReader
SiStripDetInfoFileReader m_detInfoFileReader
Definition: SiStripFedCablingFakeESSource.h:35
edm::LogWarning
Definition: MessageLogger.h:141
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
sistrip::mlCabling_
static const char mlCabling_[]
Definition: ConstantsForLogger.h:14
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
SiStripFecCabling::connections
void connections(std::vector< FedChannelConnection > &) const
Definition: SiStripFecCabling.cc:75
SiStripModule::FedChannel
Definition: SiStripModule.h:44
edm::LogVerbatim
Definition: MessageLogger.h:297
Scenarios_cff.Dets
Dets
Definition: Scenarios_cff.py:294
cms::cuda::for
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
Definition: HistoContainer.h:27
SiStripDetInfoFileReader::getAllDetIds
const std::vector< uint32_t > & getAllDetIds() const
Definition: SiStripDetInfoFileReader.h:52
SiStripFecCabling::crates
const std::vector< SiStripFecCrate > & crates() const
Definition: SiStripFecCabling.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiStripDetInfoFileReader::getNumberOfApvsAndStripLength
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
Definition: SiStripDetInfoFileReader.cc:101
L1TStage2BMTF_cff.fedIds
fedIds
Definition: L1TStage2BMTF_cff.py:10
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
SiStripFedCablingESProducer::fecCrate
static uint16_t fecCrate(const uint16_t &nth_module)
Definition: SiStripFedCablingESProducer.h:42
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
SiStripFedCablingESProducer::fecRing
static uint16_t fecRing(const uint16_t &nth_module)
Definition: SiStripFedCablingESProducer.h:46
SiStripFedCablingFakeESSource::pset_
edm::ParameterSet pset_
Definition: SiStripFedCablingFakeESSource.h:34
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
SiStripFedCablingESProducer::fecSlot
static uint16_t fecSlot(const uint16_t &nth_module)
Definition: SiStripFedCablingESProducer.h:45