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
virtual std::unique_ptr< SiStripFedCablingproduce (const SiStripFedCablingRcd &)
 
 SiStripFedCablingESProducer (const edm::ParameterSet &)
 
 ~SiStripFedCablingESProducer () override
 
- 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)
 

Protected Member Functions

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

Private Member Functions

SiStripFedCablingmake (const SiStripFedCablingRcd &) override
 

Private Attributes

edm::FileInPath fedIds_
 
edm::ParameterSet pset_
 

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
 
- 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 &)
 

Detailed Description

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

Author
R.Bainbridge

Definition at line 17 of file SiStripFedCablingFakeESSource.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file SiStripFedCablingFakeESSource.cc.

20  fedIds_( pset.getParameter<edm::FileInPath>("FedIdsFile") ),
21  pset_(pset)
22 {
23  findingRecord<SiStripFedCablingRcd>();
24  edm::LogVerbatim("FedCabling")
25  << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
26  << " Constructing object...";
27 }
T getParameter(std::string const &) const
SiStripFedCablingESProducer(const edm::ParameterSet &)
SiStripFedCablingFakeESSource::~SiStripFedCablingFakeESSource ( )
override

Definition at line 31 of file SiStripFedCablingFakeESSource.cc.

31  {
32  edm::LogVerbatim("FedCabling")
33  << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
34  << " Destructing object...";
35 }

Member Function Documentation

SiStripFedCabling * SiStripFedCablingFakeESSource::make ( const SiStripFedCablingRcd )
overrideprivatevirtual

Builds cabling map based on ascii files.

Implements SiStripFedCablingESProducer.

Definition at line 39 of file SiStripFedCablingFakeESSource.cc.

References SiStripFecCabling::addDevices(), SiStripFedCablingESProducer::ccuAddr(), SiStripFedCablingESProducer::ccuChan(), SiStripFecCabling::connections(), SiStripFecCabling::countDevices(), SiStripFecCabling::crates(), Scenarios_cff::Dets, SiStripFedCablingESProducer::fecCrate(), SiStripFedCablingESProducer::fecRing(), SiStripFedCablingESProducer::fecSlot(), SiStripModule::fedCh(), fedIds_, edm::FileInPath::fullPath(), SiStripDetInfoFileReader::getAllDetIds(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), edm::ParameterSet::getParameter(), SiStripKey::key(), LogTrace, sistrip::mlCabling_, NumberOfDevices::print(), and pset_.

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 172 of file SiStripFedCablingFakeESSource.cc.

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

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

Member Data Documentation

edm::FileInPath SiStripFedCablingFakeESSource::fedIds_
private

Location of ascii file containing FedIds.

Definition at line 36 of file SiStripFedCablingFakeESSource.h.

Referenced by make().

edm::ParameterSet SiStripFedCablingFakeESSource::pset_
private

Definition at line 37 of file SiStripFedCablingFakeESSource.h.

Referenced by make().