CMS 3D CMS Logo

SiStripFedCablingFakeESSource Class Reference

Author:
R.Bainbridge
More...

#include <CalibTracker/SiStripESProducers/plugins/fake/SiStripFedCablingFakeESSource.h>

Inheritance diagram for SiStripFedCablingFakeESSource:

SiStripFedCablingESProducer edm::EventSetupRecordIntervalFinder edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 SiStripFedCablingFakeESSource (const edm::ParameterSet &)
 ~SiStripFedCablingFakeESSource ()

Protected Member Functions

virtual void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)

Private Member Functions

virtual SiStripFedCablingmake (const SiStripFedCablingRcd &)
 Builds cabling map based on ascii files.

Private Attributes

edm::FileInPath detIds_
 Location of ascii file containing DetIds.
edm::FileInPath fedIds_
 Location of ascii file containing FedIds.


Detailed Description

Author:
R.Bainbridge

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

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.

00019   : SiStripFedCablingESProducer( pset ),
00020     detIds_( pset.getParameter<edm::FileInPath>("DetIdsFile") ),
00021     fedIds_( pset.getParameter<edm::FileInPath>("FedIdsFile") )
00022 {
00023   findingRecord<SiStripFedCablingRcd>();
00024   edm::LogVerbatim("FedCabling") 
00025     << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
00026     << " Constructing object...";
00027 }

SiStripFedCablingFakeESSource::~SiStripFedCablingFakeESSource (  ) 

Definition at line 31 of file SiStripFedCablingFakeESSource.cc.

00031                                                               {
00032   edm::LogVerbatim("FedCabling")
00033     << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
00034     << " Destructing object...";
00035 }


Member Function Documentation

SiStripFedCabling * SiStripFedCablingFakeESSource::make ( const SiStripFedCablingRcd  )  [private, virtual]

Builds cabling map based on ascii files.

Implements SiStripFedCablingESProducer.

Definition at line 39 of file SiStripFedCablingFakeESSource.cc.

References SiStripFecCabling::addDevices(), addr, SiStripFedCablingESProducer::ccuAddr(), SiStripFedCablingESProducer::ccuChan(), SiStripFecCabling::connections(), SiStripFecCabling::countDevices(), SiStripFecCabling::crates(), detIds_, lat::endl(), SiStripFedCablingESProducer::fecCrate(), SiStripFedCablingESProducer::fecRing(), SiStripFedCablingESProducer::fecSlot(), fedIds_, edm::FileInPath::fullPath(), LogTrace, sistrip::mlCabling_, NumberOfDevices::print(), and ss.

00039                                                                                     {
00040   edm::LogVerbatim("FedCabling")
00041     << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
00042     << " Building \"fake\" FED cabling map"
00043     << " from real DetIds and FedIds (read from ascii file)";
00044   
00045   // Create FEC cabling object 
00046   SiStripFecCabling* fec_cabling = new SiStripFecCabling();
00047   
00048   // Read DetId list from file
00049   typedef std::map<uint32_t,SiStripDetInfoFileReader::DetInfo>  Dets;
00050   Dets dets = SiStripDetInfoFileReader( detIds_.fullPath() ).getAllData();
00051   
00052   // Read FedId list from file
00053   typedef std::vector<uint16_t> Feds;
00054   Feds feds = SiStripFedIdListReader( fedIds_.fullPath() ).fedIds();
00055   
00056   // Iterator through DetInfo objects and populate FEC cabling object
00057   uint32_t imodule = 0;
00058   Dets::const_iterator idet = dets.begin();
00059   Dets::const_iterator jdet = dets.end();
00060   for ( ; idet != jdet; ++idet ) {
00061     uint16_t npairs = idet->second.nApvs / 2;
00062     for ( uint16_t ipair = 0; ipair < npairs; ++ipair ) {
00063       uint16_t addr = 0;
00064       if      ( npairs == 2 && ipair == 0 ) { addr = 32; }
00065       else if ( npairs == 2 && ipair == 1 ) { addr = 36; }
00066       else if ( npairs == 3 && ipair == 0 ) { addr = 32; }
00067       else if ( npairs == 3 && ipair == 1 ) { addr = 34; }
00068       else if ( npairs == 3 && ipair == 2 ) { addr = 36; }
00069       else {
00070         edm::LogWarning("FedCabling") 
00071           << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
00072           << " Inconsistent values for nPairs (" << npairs
00073           << ") and ipair (" << ipair << ")!";
00074       }
00075       FedChannelConnection conn( fecCrate( imodule ),
00076                                  fecSlot( imodule ), 
00077                                  fecRing( imodule ), 
00078                                  ccuAddr( imodule ), 
00079                                  ccuChan( imodule ), 
00080                                  addr, addr+1, // apv i2c addresses
00081                                  imodule+1,    // dcu id
00082                                  idet->first,  // det id
00083                                  npairs );     // apv pairs
00084       fec_cabling->addDevices( conn );
00085     }
00086     imodule++;
00087   }
00088 
00089   // Assign "dummy" FED ids/chans
00090   bool insufficient = false;
00091   Feds::const_iterator ifed = feds.begin();
00092   uint16_t fed_ch = 0;
00093   for ( std::vector<SiStripFecCrate>::const_iterator icrate = fec_cabling->crates().begin(); icrate != fec_cabling->crates().end(); icrate++ ) {
00094     for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
00095       for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
00096         for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
00097           for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
00098             for ( uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++ ) {
00099               
00100               if ( ifed == feds.end() ) { fed_ch++; ifed = feds.begin(); }
00101               if ( fed_ch == 96 ) {
00102                 insufficient = true;
00103                 break;
00104               }
00105               
00106               std::pair<uint16_t,uint16_t> addr = imod->activeApvPair( imod->lldChannel(ipair) );
00107               SiStripModule::FedChannel fed_channel( (*ifed)/16+1, // 16 FEDs per crate, numbering starts from 1
00108                                                      (*ifed)%16+2, // FED slot starts from 2
00109                                                      *ifed,
00110                                                      fed_ch );
00111               const_cast<SiStripModule&>(*imod).fedCh( addr.first, fed_channel );
00112               ifed++;
00113               
00114             }
00115           }
00116         }
00117       }
00118     }
00119   }
00120 
00121   if ( insufficient ) {
00122     edm::LogWarning(mlCabling_)
00123       << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
00124       << " Insufficient FED channels to cable entire system!";
00125   }
00126   
00127   // Some debug
00128   std::stringstream ss;
00129   ss << "[SiStripFedCablingFakeESSource::" << __func__ << "]"
00130      <<" First count devices of FEC cabling " << std::endl;
00131   fec_cabling->countDevices().print(ss);
00132   LogTrace(mlCabling_) << ss.str();
00133   
00134   // Build FED cabling using FedChannelConnections
00135   std::vector<FedChannelConnection> conns;
00136   fec_cabling->connections( conns ); 
00137   SiStripFedCabling* cabling = new SiStripFedCabling( conns );
00138   
00139   return cabling;
00140   
00141 }

void SiStripFedCablingFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iov_sync,
edm::ValidityInterval iov_validity 
) [protected, virtual]

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 145 of file SiStripFedCablingFakeESSource.cc.

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

00147                                                                                         {
00148   edm::ValidityInterval infinity( iov_sync.beginOfTime(), iov_sync.endOfTime() );
00149   iov_validity = infinity;
00150 }


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:21 2009 for CMSSW by  doxygen 1.5.4