CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from SiStripFedCablingESProducer
virtual std::auto_ptr
< SiStripFedCabling
produce (const SiStripFedCablingRcd &)
 
 SiStripFedCablingESProducer (const edm::ParameterSet &)
 
virtual ~SiStripFedCablingESProducer ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- 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 ()
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder ()
 

Protected Member Functions

virtual void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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

virtual SiStripFedCablingmake (const SiStripFedCablingRcd &)
 

Private Attributes

edm::FileInPath detIds_
 
edm::FileInPath fedIds_
 
edm::ParameterSet pset_
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- 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)
 

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  detIds_( pset.getParameter<edm::FileInPath>("DetIdsFile") ),
21  fedIds_( pset.getParameter<edm::FileInPath>("FedIdsFile") ),
22  pset_(pset)
23 {
24  findingRecord<SiStripFedCablingRcd>();
25  edm::LogVerbatim("FedCabling")
26  << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
27  << " Constructing object...";
28 }
T getParameter(std::string const &) const
SiStripFedCablingESProducer(const edm::ParameterSet &)
SiStripFedCablingFakeESSource::~SiStripFedCablingFakeESSource ( )

Definition at line 32 of file SiStripFedCablingFakeESSource.cc.

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

Member Function Documentation

SiStripFedCabling * SiStripFedCablingFakeESSource::make ( const SiStripFedCablingRcd )
privatevirtual

Builds cabling map based on ascii files.

Implements SiStripFedCablingESProducer.

Definition at line 40 of file SiStripFedCablingFakeESSource.cc.

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

40  {
41  edm::LogVerbatim("FedCabling")
42  << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
43  << " Building \"fake\" FED cabling map"
44  << " from real DetIds and FedIds (read from ascii file)";
45 
46  // Create FEC cabling object
47  SiStripFecCabling* fec_cabling = new SiStripFecCabling();
48 
49  // Read DetId list from file
51  typedef std::vector<uint32_t> Dets;
52 
53  Dets dets = Detreader.getAllDetIds();
54 
55  // Read FedId list from file
56  typedef std::vector<uint16_t> Feds;
57  Feds feds = SiStripFedIdListReader( fedIds_.fullPath() ).fedIds();
58 
59  bool populateAllFeds=pset_.getParameter<bool>("PopulateAllFeds");
60 
61  // Iterator through DetInfo objects and populate FEC cabling object
62  uint32_t imodule = 0;
63  Dets::const_iterator idet = dets.begin();
64  Dets::const_iterator jdet = dets.end();
65  for ( ; idet != jdet; ++idet ) {
66  uint16_t npairs = Detreader.getNumberOfApvsAndStripLength(*idet).first / 2;
67  for ( uint16_t ipair = 0; ipair < npairs; ++ipair ) {
68  uint16_t addr = 0;
69  if ( npairs == 2 && ipair == 0 ) { addr = 32; }
70  else if ( npairs == 2 && ipair == 1 ) { addr = 36; }
71  else if ( npairs == 3 && ipair == 0 ) { addr = 32; }
72  else if ( npairs == 3 && ipair == 1 ) { addr = 34; }
73  else if ( npairs == 3 && ipair == 2 ) { addr = 36; }
74  else {
75  edm::LogWarning("FedCabling")
76  << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
77  << " Inconsistent values for nPairs (" << npairs
78  << ") and ipair (" << ipair << ")!";
79  }
80  uint32_t module_key = SiStripFecKey(fecCrate( imodule ),
81  fecSlot( imodule ),
82  fecRing( imodule ),
83  ccuAddr( imodule ),
84  ccuChan( imodule )).key();
85  FedChannelConnection conn( fecCrate( imodule ),
86  fecSlot( imodule ),
87  fecRing( imodule ),
88  ccuAddr( imodule ),
89  ccuChan( imodule ),
90  addr, addr+1, // apv i2c addresses
91  module_key, // dcu id
92  *idet, // det id
93  npairs ); // apv pairs
94  fec_cabling->addDevices( conn );
95  }
96  imodule++;
97  }
98 
99  // Assign "dummy" FED ids/chans
100  bool insufficient = false;
101  Feds::const_iterator ifed = feds.begin();
102  uint16_t fed_ch = 0;
103  for ( std::vector<SiStripFecCrate>::const_iterator icrate = fec_cabling->crates().begin(); icrate != fec_cabling->crates().end(); icrate++ ) {
104  for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
105  for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
106  for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
107  for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
108  if(populateAllFeds){
109  for ( uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++ ) {
110 
111  if ( ifed == feds.end() ) { fed_ch++; ifed = feds.begin(); }
112  if ( fed_ch == 96 ) {
113  insufficient = true;
114  break;
115  }
116 
117  std::pair<uint16_t,uint16_t> addr = imod->activeApvPair( imod->lldChannel(ipair) );
118  SiStripModule::FedChannel fed_channel( (*ifed)/16+1, // 16 FEDs per crate, numbering starts from 1
119  (*ifed)%16+2, // FED slot starts from 2
120  *ifed,
121  fed_ch );
122  const_cast<SiStripModule&>(*imod).fedCh( addr.first, fed_channel );
123  ifed++;
124 
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() ) { ifed++; fed_ch = 0; } // move to next FED
132  for ( uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++ ) {
133  std::pair<uint16_t,uint16_t> addr = imod->activeApvPair( (*imod).lldChannel(ipair) );
134  SiStripModule::FedChannel fed_channel( (*ifed)/16+1, // 16 FEDs per crate, numbering starts from 1
135  (*ifed)%16+2, // FED slot starts from 2
136  (*ifed),
137  fed_ch );
138  const_cast<SiStripModule&>(*imod).fedCh( addr.first, fed_channel );
139  fed_ch++;
140  }
141 
142  }
143  }
144  }
145  }
146  }
147  }
148 
149  if ( insufficient ) {
151  << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
152  << " Insufficient FED channels to cable entire system!";
153  }
154 
155  // Some debug
156  std::stringstream ss;
157  ss << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
158  <<" First count devices of FEC cabling " << std::endl;
159  fec_cabling->countDevices().print(ss);
160  LogTrace(mlCabling_) << ss.str();
161 
162  // Build FED cabling using FedChannelConnections
163  std::vector<FedChannelConnection> conns;
164  fec_cabling->connections( conns );
165  SiStripFedCabling* cabling = new SiStripFedCabling( conns );
166 
167  return cabling;
168 
169 }
Device and connection information at the level of a front-end module.
Definition: SiStripModule.h:25
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)
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:126
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
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:170
NumberOfDevices countDevices() const
void SiStripFedCablingFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iov_sync,
edm::ValidityInterval iov_validity 
)
protectedvirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 173 of file SiStripFedCablingFakeESSource.cc.

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

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

Member Data Documentation

edm::FileInPath SiStripFedCablingFakeESSource::detIds_
private

Location of ascii file containing DetIds.

Definition at line 36 of file SiStripFedCablingFakeESSource.h.

Referenced by make().

edm::FileInPath SiStripFedCablingFakeESSource::fedIds_
private

Location of ascii file containing FedIds.

Definition at line 39 of file SiStripFedCablingFakeESSource.h.

Referenced by make().

edm::ParameterSet SiStripFedCablingFakeESSource::pset_
private

Definition at line 40 of file SiStripFedCablingFakeESSource.h.

Referenced by make().