diff --git a/Alignment/LaserAlignment/plugins/LaserAlignmentEventFilter.cc b/Alignment/LaserAlignment/plugins/LaserAlignmentEventFilter.cc index f488100769f0f..8be5624cc547a 100644 --- a/Alignment/LaserAlignment/plugins/LaserAlignmentEventFilter.cc +++ b/Alignment/LaserAlignment/plugins/LaserAlignmentEventFilter.cc @@ -91,7 +91,7 @@ bool LaserAlignmentEventFilter::filter( edm::Event& iEvent, const edm::EventSetu } // get the cabling connections for this FED - const std::vector& conns = cabling->connections(*ifed); + auto conns = cabling->fedConnections(*ifed); // construct FEDBuffer std::auto_ptr buffer; diff --git a/CalibFormats/SiStripObjects/src/SiStripDetCabling.cc b/CalibFormats/SiStripObjects/src/SiStripDetCabling.cc index f98ae13324244..c8e51af1de56b 100644 --- a/CalibFormats/SiStripObjects/src/SiStripDetCabling.cc +++ b/CalibFormats/SiStripObjects/src/SiStripDetCabling.cc @@ -24,12 +24,10 @@ SiStripDetCabling::SiStripDetCabling(const SiStripFedCabling& fedcabling) : full // --- CONNECTED = have fedid and i2cAddr // create fullcabling_, loop over vector of FedChannelConnection, either make new element of map, or add to appropriate vector of existing map element // get feds list (vector) from fedcabling object - these are the active FEDs - const std::vector& feds = fedcabling.feds(); - std::vector::const_iterator ifed; - for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // iterate over active feds, get all their FedChannelConnection-s + auto feds = fedcabling.fedIds(); + for ( auto ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // iterate over active feds, get all their FedChannelConnection-s SiStripFedCabling::ConnsConstIterRange conns = fedcabling.fedConnections( *ifed ); - std::vector::const_iterator iconn; - for ( iconn = conns.begin(); iconn != conns.end(); iconn++ ) { // loop over FedChannelConnection objects + for ( auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) { // loop over FedChannelConnection objects addDevices(*iconn, fullcabling_); // leave separate method, in case you will need to add devices also after constructing bool have_fed_id = iconn->fedId(); std::vector vector_of_connected_apvs; diff --git a/CalibFormats/SiStripObjects/src/SiStripFecCabling.cc b/CalibFormats/SiStripObjects/src/SiStripFecCabling.cc index 58f3d3fb54f65..60adea2698505 100644 --- a/CalibFormats/SiStripObjects/src/SiStripFecCabling.cc +++ b/CalibFormats/SiStripObjects/src/SiStripFecCabling.cc @@ -28,14 +28,12 @@ void SiStripFecCabling::buildFecCabling( const SiStripFedCabling& fed_cabling ) << " Building FEC cabling..."; // Retrieve and iterate through FED ids - const std::vector& feds = fed_cabling.feds(); - std::vector::const_iterator ifed; - for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { + auto feds = fed_cabling.fedIds(); + for ( auto ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // Retrieve and iterate through FED channel connections - const std::vector& conns = fed_cabling.connections( *ifed ); - std::vector::const_iterator iconn; - for ( iconn = conns.begin(); iconn != conns.end(); iconn++ ) { + auto conns = fed_cabling.fedConnections( *ifed ); + for ( auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) { // Check that FED id is not invalid and add devices if ( iconn->fedId() != sistrip::invalid_ ) { addDevices( *iconn ); } diff --git a/CalibFormats/SiStripObjects/src/SiStripQuality.cc b/CalibFormats/SiStripObjects/src/SiStripQuality.cc index e5c5c37efdda9..adf4a2c25f764 100644 --- a/CalibFormats/SiStripObjects/src/SiStripQuality.cc +++ b/CalibFormats/SiStripObjects/src/SiStripQuality.cc @@ -156,8 +156,9 @@ void SiStripQuality::add(const RunInfo *runInfo) if( !allFedsEmpty || useEmptyRunInfo_ ) { // Take the list of active feds from fedCabling - std::vector activeFedsFromCabling = SiStripDetCabling_->fedCabling()->feds(); + auto ids = SiStripDetCabling_->fedCabling()->fedIds(); + std::vector activeFedsFromCabling(ids.begin(), ids.end()); // Take the list of active feds from RunInfo std::vector activeFedsFromRunInfo; // Take only Tracker feds (remove all non Tracker) @@ -180,7 +181,8 @@ void SiStripQuality::add(const RunInfo *runInfo) activeFedsFromRunInfo.begin(), activeFedsFromRunInfo.end(), std::back_inserter(differentFeds)); - printActiveFedsInfo(activeFedsFromCabling, activeFedsFromRunInfo, differentFeds, printDebug_); + // IGNORE for time being. + //printActiveFedsInfo(activeFedsFromCabling, activeFedsFromRunInfo, differentFeds, printDebug_); // Feds in the differentFeds vector are now to be turned off as they are off according to RunInfo // but were not off in cabling and thus are still active for the SiStripQuality. @@ -767,8 +769,8 @@ void SiStripQuality::turnOffFeds(const std::vector & fedsList, const bool t std::vector::const_iterator fedIdIt = fedsList.begin(); for( ; fedIdIt != fedsList.end(); ++fedIdIt ) { - std::vector::const_iterator fedChIt = SiStripDetCabling_->fedCabling()->connections( *fedIdIt ).begin(); - for( ; fedChIt != SiStripDetCabling_->fedCabling()->connections( *fedIdIt ).end(); ++fedChIt ) { + std::vector::const_iterator fedChIt = SiStripDetCabling_->fedCabling()->fedConnections( *fedIdIt ).begin(); + for( ; fedChIt != SiStripDetCabling_->fedCabling()->fedConnections( *fedIdIt ).end(); ++fedChIt ) { uint32_t detId = fedChIt->detId(); if (detId == 0 || detId == 0xFFFFFFFF) continue; uint16_t apvPairNumber = fedChIt->apvPairNumber(); diff --git a/CalibTracker/SiStripCommon/src/SiStripDCSStatus.cc b/CalibTracker/SiStripCommon/src/SiStripDCSStatus.cc index a44eb91652fbc..512a32f8e37b7 100644 --- a/CalibTracker/SiStripCommon/src/SiStripDCSStatus.cc +++ b/CalibTracker/SiStripCommon/src/SiStripDCSStatus.cc @@ -104,7 +104,7 @@ void SiStripDCSStatus::initialise(edm::Event const& e, edm::EventSetup const& eS edm::ESHandle< SiStripFedCabling > fedCabling_; eSetup.get().get(fedCabling_); - const std::vector& connectedFEDs = fedCabling_->feds(); + auto connectedFEDs = fedCabling_->fedIds(); edm::Handle rawDataHandle; e.getByLabel("source", rawDataHandle); @@ -117,7 +117,7 @@ void SiStripDCSStatus::initialise(edm::Event const& e, edm::EventSetup const& eS rawdataAbsent = false; const FEDRawDataCollection& rawDataCollection = *rawDataHandle; for(std::vector::const_iterator ifed = connectedFEDs.begin(); ifed != connectedFEDs.end(); ifed++){ - const std::vector fedChannels = fedCabling_->connections( *ifed ); + auto fedChannels = fedCabling_->fedConnections( *ifed ); if (!(rawDataCollection.FEDData(*ifed).size()) || !(rawDataCollection.FEDData(*ifed).data()) ) continue; // Check Modules Connected for (std::vector::const_iterator iconn = fedChannels.begin(); diff --git a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc index 80d73fc807765..693774a24315a 100644 --- a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc +++ b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc @@ -105,12 +105,10 @@ void SiStripFedCablingManipulator::manipulate(const SiStripFedCabling* iobj,SiSt std::vector conns; - const std::vector& feds=iobj->feds(); - std::vector::const_iterator ifeds=feds.begin(); - for(;ifeds!=feds.end();ifeds++){ - const std::vector& conns_per_fed =iobj->connections( *ifeds ); - std::vector::const_iterator iconn=conns_per_fed.begin(); - for(;iconn!=conns_per_fed.end();++iconn){ + auto feds=iobj->fedIds(); + for(auto ifeds=feds.begin();ifeds!=feds.end();ifeds++){ + auto conns_per_fed =iobj->fedConnections( *ifeds ); + for(auto iconn=conns_per_fed.begin();iconn!=conns_per_fed.end();++iconn){ std::map >::const_iterator it=dcuDetIdMap.find(iconn->dcuId()); if(it!=dcuDetIdMap.end() && it->second.first==iconn->detId()){ edm::LogInfo("SiStripFedCablingManipulator")<< "::manipulate - fedid "<< *ifeds << " dcuid " << iconn->dcuId() << " oldDet " << iconn->detId() << " newDetID " << it->second.second ; diff --git a/CommonTools/TrackerMap/src/TrackerMap.cc b/CommonTools/TrackerMap/src/TrackerMap.cc index fbd76e7877500..695816d1a6440 100644 --- a/CommonTools/TrackerMap/src/TrackerMap.cc +++ b/CommonTools/TrackerMap/src/TrackerMap.cc @@ -66,14 +66,14 @@ TrackerMap::TrackerMap(const edm::ParameterSet & tkmapPset,const SiStripFedCabli init(); // Now load fed cabling information if(enableFedProcessing){ - const std::vector feds = tkFed->feds(); + auto feds = tkFed->fedIds(); std::cout<<"SiStripFedCabling has "<< feds.size()<<" active FEDS"<::const_iterator ifed = feds.begin();ifed theconn = tkFed->connections( *ifed ); + auto theconn = tkFed->fedConnections( *ifed ); int num_conn=0; - for(std::vector::const_iterator iconn = theconn.begin();iconnfedId()== sistrip::invalid_ || iconn->detId() == sistrip::invalid_ || diff --git a/CondFormats/SiStripObjects/interface/SiStripFedCabling.h b/CondFormats/SiStripObjects/interface/SiStripFedCabling.h index 603496d79f1f5..836e8c5a5f0d4 100644 --- a/CondFormats/SiStripObjects/interface/SiStripFedCabling.h +++ b/CondFormats/SiStripObjects/interface/SiStripFedCabling.h @@ -12,118 +12,6 @@ #define SISTRIPCABLING_USING_NEW_INTERFACE -// ------------------------------------------------------- -#ifndef SISTRIPCABLING_USING_NEW_STRUCTURE // ------------ -// ------------------------------------------------------- - - -class SiStripFedCabling; - -/** Debug info for SiStripFedCabling class. */ -std::ostream& operator<< ( std::ostream&, const SiStripFedCabling& ); - -/** - \class SiStripFedCabling - \brief Contains cabling info at the device level, including - DetId, APV pair numbers, hardware addresses, DCU id... -*/ -class SiStripFedCabling { - - public: - - // -------------------- Constructors, destructors -------------------- - - /** Constructor taking FED channel connection objects as input. */ - SiStripFedCabling( const std::vector& ); - - /** Copy constructor. */ - SiStripFedCabling( const SiStripFedCabling& ); - - /** Public default constructor. */ - SiStripFedCabling(); - - /** Default destructor. */ - ~SiStripFedCabling(); - - // -------------------- Utility methods -------------------- - - /** Builds FED cabling from vector of FED connections. */ - void buildFedCabling( const std::vector& connections ); - - /** Prints all connection information for this FED cabling object. */ - void print( std::stringstream& ) const; - - /** Prints terse information for this FED cabling object. */ - void terse( std::stringstream& ) const; - - /** Prints summary information for this FED cabling object. */ - void summary( std::stringstream& ) const; - - // -------------------- Methods to retrieve connections -------------------- - - /** Retrieve vector of active FED ids. */ - const std::vector& feds() const; - - /** Returns all connection info for a given FED id. */ - const std::vector& connections( uint16_t fed_id ) const; - - /** Returns Connection info for a given FED id and channel. */ - const FedChannelConnection& connection( uint16_t fed_id, - uint16_t fed_chan ) const; - - /** Returns information for "detected, but unconnected" devices. */ - inline const std::vector& detected() const; - - /** Returns information for all "undetected" devices. */ - inline const std::vector& undetected() const; - - // -------------------- Private member data -------------------- - - private: - - /** "Active" FEDs that have connected FE devices. */ - std::vector feds_; - - /** - Channel-level connection information for FE devices that: - - have been detected (ie, have non-zero FEC-related fields), - - have been connected to a FED channel, - - have a DcuId/DetId or NOT (=> cannot be used by recon sw). - Info is arranged according to FED id and channel. - (1st index is FED id, 2nd index is FED channel.) - */ - std::vector< std::vector > connected_; - - /** - Channel-level connection information for FE devices that: - - have been detected (ie, have non-zero FEC-related fields), - - have NOT been connected to a FED channel, - - have OR do not have a DcuId/DetId. - */ - std::vector detected_; - - /** - Channel-level connection information for FE devices that: - - have NOT been detected (ie, have zero FEC-related fields), - - have NOT been connected to a FED channel, - - do NOT have a DCU id. - The DetId for these devices are inferred from the static LUT in - the configuration database. - */ - std::vector undetected_; - -}; - -const std::vector& SiStripFedCabling::detected() const { return detected_; } -const std::vector& SiStripFedCabling::undetected() const{ return undetected_; } - - -// ------------------------------------------------------------- -#else // SISTRIPCABLING_USING_NEW_STRUCTURE -------------------- -#ifndef SISTRIPCABLING_USING_NEW_INTERFACE // ------------------ -// ------------------------------------------------------------- - - class SiStripFedCabling; /** Debug info for SiStripFedCabling class. */ @@ -164,224 +52,6 @@ class SiStripFedCabling { typedef std::vector Registry; - // -------------------- Constructors, destructors -------------------- - - /** Constructor taking FED channel connection objects as input. */ - SiStripFedCabling( const std::vector& ); - - /** Copy constructor. */ - SiStripFedCabling( const SiStripFedCabling& ); - - /** Public default constructor. */ - SiStripFedCabling(); - - /** Default destructor. */ - ~SiStripFedCabling(); - - // -------------------- Methods to retrieve connections -------------------- - - /** Retrieve vector of active FED ids. */ - const std::vector& feds() const; - - /** Returns all connection info for a given FED id. */ - const std::vector& connections( uint16_t fed_id ) const; - - /** Returns Connection info for a given FED id and channel. */ - const FedChannelConnection& connection( uint16_t fed_id, - uint16_t fed_chan ) const; - - /** Returns information for "detected, but unconnected" devices. */ - inline const std::vector& detected() const; - - /** Returns information for all "undetected" devices. */ - inline const std::vector& undetected() const; - - // -------------------- Utility methods -------------------- - - /** Builds FED cabling from vector of FED connections. */ - void buildFedCabling( const std::vector& connections ); - - /** Prints all connection information for this FED cabling object. */ - void print( std::stringstream& ) const; - - /** Prints terse information for this FED cabling object. */ - void terse( std::stringstream& ) const; - - /** Prints summary information for this FED cabling object. */ - void summary( std::stringstream& ) const; - - /// Builds range of iterators from pair of offsets - class ConnsRange { - - public: - - ConnsRange( const Conns&, ConnsPair ); - ConnsRange( const Conns& ); - ConnsRange() {;} - - ConnsConstIter begin() const; - ConnsConstIter end() const; - ConnsConstIterRange range() const; - ConnsConstIterRange invalid() const; - - bool empty() const; - uint32_t size() const; - - ConnsPair connsPair() const; - static ConnsPair emptyPair(); - - void print( std::stringstream& ) const; - - private: - - ConnsConstIterRange vector_; - ConnsConstIterRange range_; - - }; - - /// Builds range of iterators from pair of offsets - ConnsRange range( ConnsPair ) const; - - // -------------------- Private member data -------------------- - - private: - - /// "Active" FEDs that have connected FE devices - Feds feds_; - - /// Container of "ranges" indexed by FED id - Registry registry_; - - /// Container of connection objects - Conns connections_; - - /// Connections to FE devices that are not detected - Conns detected_; - - /// FE devices that are detected - Conns undetected_; - -}; - -std::ostream& operator<<( std::ostream&, const SiStripFedCabling::ConnsRange& ); - -inline const std::vector& SiStripFedCabling::detected() const { - return detected_; -} - -inline const std::vector& SiStripFedCabling::undetected() const{ - return undetected_; -} - -inline SiStripFedCabling::ConnsConstIter SiStripFedCabling::ConnsRange::begin() const { - return range_.begin(); -} - -inline SiStripFedCabling::ConnsConstIter SiStripFedCabling::ConnsRange::end() const { - return range_.end(); -} - -inline SiStripFedCabling::ConnsConstIterRange SiStripFedCabling::ConnsRange::range() const { - return range_; -} - -inline SiStripFedCabling::ConnsConstIterRange SiStripFedCabling::ConnsRange::invalid() const { - return ConnsConstIterRange( vector_.end(), vector_.end() ); -} - -inline bool SiStripFedCabling::ConnsRange::empty() const { - return ( range_.begin() == range_.end() ); -} - -inline uint32_t SiStripFedCabling::ConnsRange::size() const { - return std::distance( range_.begin(), range_.end() ); -} - -inline SiStripFedCabling::ConnsPair SiStripFedCabling::ConnsRange::connsPair() const { - return ( ( range_.begin() == vector_.end() && - range_.end() == vector_.end() ) ? - ConnsPair( sistrip::invalid32_, sistrip::invalid32_ ) : - ConnsPair( std::distance( vector_.begin(), range_.begin() ), - std::distance( vector_.begin(), range_.end() ) ) ); -} - -inline SiStripFedCabling::ConnsPair SiStripFedCabling::ConnsRange::emptyPair() { - return ConnsPair( sistrip::invalid32_, sistrip::invalid32_ ); -} - -inline SiStripFedCabling::ConnsRange SiStripFedCabling::range( SiStripFedCabling::ConnsPair p ) const { - return ConnsRange( connections_, p ); -} - - -// ------------------------------------------------------------- -#else // SISTRIPCABLING_USING_NEW_INTERFACE -------------------- -// ------------------------------------------------------------- - - -class SiStripFedCabling; - -/** Debug info for SiStripFedCabling class. */ -std::ostream& operator<< ( std::ostream&, const SiStripFedCabling& ); - -/** - \class SiStripFedCabling - \brief Contains cabling info at the device level, including - DetId, APV pair numbers, hardware addresses, DCU id... -*/ -class SiStripFedCabling { - - public: - - // -------------------- Typedefs and structs -------------------- - - typedef std::vector Feds; - - typedef Feds::iterator FedsIter; - - typedef Feds::const_iterator FedsConstIter; - - typedef boost::iterator_range FedsIterRange; - - typedef boost::iterator_range FedsConstIterRange; - - typedef std::vector Conns; - - typedef Conns::iterator ConnsIter; - - typedef Conns::const_iterator ConnsConstIter; - - typedef boost::iterator_range ConnsIterRange; - - typedef boost::iterator_range ConnsConstIterRange; - - typedef std::pair ConnsPair; - - typedef std::vector Registry; - - // -------------------- TO BE DEPRECATED! -------------------- - - /** TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! */ - SiStripFedCabling( const std::vector& ); - - /** TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! */ - void buildFedCabling( const std::vector& ); - - /** TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! */ - const std::vector& connections( uint16_t fed_id ) const; - - /** TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! */ - const FedChannelConnection& connection( uint16_t fed_id, uint16_t fed_ch ) const; - - /** TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! */ - const std::vector& feds() const; - - /** TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! */ - const std::vector& detected() const; - - /** TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! */ - const std::vector& undetected() const; - // -------------------- Constructors, destructors -------------------- /** Constructor taking FED channel connection objects as input. */ @@ -543,11 +213,5 @@ inline SiStripFedCabling::ConnsRange SiStripFedCabling::range( SiStripFedCabling return ConnsRange( connections_, p ); } - -// ------------------------------------------------------------- -#endif // SISTRIPCABLING_USING_NEW_INTERFACE ------------------- -#endif // SISTRIPCABLING_USING_NEW_STRUCTURE ------------------- -// ------------------------------------------------------------- - #endif // CondFormats_SiStripObjects_SiStripFedCabling_H diff --git a/CondFormats/SiStripObjects/src/SiStripFedCabling.cc b/CondFormats/SiStripObjects/src/SiStripFedCabling.cc index 791155b115053..e451d8b887d79 100644 --- a/CondFormats/SiStripObjects/src/SiStripFedCabling.cc +++ b/CondFormats/SiStripObjects/src/SiStripFedCabling.cc @@ -8,968 +8,6 @@ using namespace sistrip; -// ----------------------------------------------------------------------------- -#ifndef SISTRIPCABLING_USING_NEW_STRUCTURE // ---------------------------------- -// ----------------------------------------------------------------------------- - - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::SiStripFedCabling( const std::vector& input ) - : feds_(), - connected_(), - detected_(), - undetected_() -{ - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Constructing object..."; - buildFedCabling( input ); -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::SiStripFedCabling( const SiStripFedCabling& input ) - : feds_(), - connected_(), - detected_(), - undetected_() -{ - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Constructing object..."; - - std::vector v_fcc; - - // Retrieve FED ids from cabling map and iterate through - const std::vector& fedids = input.feds(); - std::vector::const_iterator ifed=fedids.begin(); - for ( ; ifed != fedids.end(); ++ifed ) { - //copy the vector of FedChannelConnection for the given ifed - v_fcc.insert(v_fcc.end(),input.connections(*ifed).begin(),input.connections(*ifed).end()); - } - - buildFedCabling( v_fcc ); - -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::SiStripFedCabling() - : feds_(), - connected_(), - detected_(), - undetected_() -{ - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Constructing object..."; -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::~SiStripFedCabling() { - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Destructing object..."; -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::buildFedCabling( const std::vector& input ) { - - // Check input - if ( input.empty() ) { - edm::LogError(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Input vector of FedChannelConnections is of zero size!" - << " Unable to populate FED cabling object!"; - return; - } - - std::stringstream ss; - ss << "[SiStripFedCabling::" << __func__ << "]" - << " Building FED cabling from " - << input.size() - << " connections..."; - LogTrace(mlCabling_) << ss.str(); - - // Clear containers - connected_.clear(); - detected_.clear(); - undetected_.clear(); - - // Iterate through FEDs - for ( uint16_t iconn = 0; iconn < input.size(); iconn++ ) { - - if ( !input[iconn].isConnected() ) { continue; } - - uint16_t fed_id = input[iconn].fedId(); - uint16_t fed_ch = input[iconn].fedCh(); - - // Check on FED ids and channels - if ( fed_id > sistrip::CMS_FED_ID_MAX ) { - if ( edm::isDebugEnabled() ) { - edm::LogWarning(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Unexpected FED id! " << fed_id; - } - continue; - } - if ( fed_ch >= sistrip::FEDCH_PER_FED ) { - if ( edm::isDebugEnabled() ) { - edm::LogWarning(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Unexpected FED channel! " << fed_ch; - } - continue; - } - - // Resize container to accommodate all FED channels - if ( connected_.size() <= fed_id ) { connected_.resize(fed_id+1); } - if ( connected_[fed_id].size() != 96 ) { connected_[fed_id].resize(96); } - - // Fill appropriate container - bool detected = input[iconn].i2cAddr(0) || input[iconn].i2cAddr(1); - bool connected = input[iconn].fedId(); //@@ should check also FeUnit/FeChan are not invalid ??? - if ( detected && connected ) { - connected_[fed_id][fed_ch] = input[iconn]; - } else if ( detected && !connected ) { - detected_.push_back( input[iconn] ); - } else if ( !detected && !connected ) { - undetected_.push_back( input[iconn] ); - } - - if ( detected && connected ) { - std::vector::iterator id = find( feds_.begin(), feds_.end(), fed_id ); - if ( id == feds_.end() ) { feds_.push_back( fed_id ); } - } - - } - -} - -// ----------------------------------------------------------------------------- -// Returns active FEDs -const std::vector& SiStripFedCabling::feds() const { - return feds_; -} - -// ----------------------------------------------------------------------------- -// Returns connection info for FE devices connected to given FED id and channel -const FedChannelConnection& SiStripFedCabling::connection( uint16_t fed_id, - uint16_t fed_chan ) const { - - //@@ should use connections(fed_id) method here!!! - - if ( !connected_.empty() ) { - if ( fed_id < connected_.size() ) { - if ( !connected_[fed_id].empty() ) { - if ( fed_chan < connected_[fed_id].size() ) { - return connected_[fed_id][fed_chan]; - } else { - if ( edm::isDebugEnabled() ) { - edm::LogWarning(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " FED channel (" << fed_chan - << ") is greater than or equal to vector size (" - << connected_[fed_chan].size() << ")!"; - } - } - } else { - if ( edm::isDebugEnabled() ) { - edm::LogWarning(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Cabling map is empty for FED id " - << fed_id; - } - } - } else { - if ( edm::isDebugEnabled() ) { - edm::LogWarning(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " FED id (" << fed_id - << ") is greater than or equal to vector size (" - << connected_.size() << ")!"; - } - } - } else { - edm::LogError(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Cabling map is empty!"; - } - - static FedChannelConnection conn; - return conn; - -} - -// ----------------------------------------------------------------------------- -// Returns connection info for FE devices connected to given FED -const std::vector& SiStripFedCabling::connections( uint16_t fed_id ) const { - - if ( !connected_.empty() ) { - if ( fed_id < connected_.size() ) { - if ( !connected_[fed_id].empty() ) { - return connected_[fed_id]; - } else { - if ( edm::isDebugEnabled() ) { - edm::LogWarning(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Cabling map is empty for FED id " - << fed_id; - } - } - } else { - if ( edm::isDebugEnabled() ) { - edm::LogWarning(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " FED id (" << fed_id - << ") is greater than or equal to vector size (" - << connected_.size() << ")!"; - } - } - } else { - edm::LogError(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Cabling map is empty!"; - } - - static FedChannelConnection conn; - static std::vector connections(96,conn); - return connections; - -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::print( std::stringstream& ss ) const { - - const std::vector& fed_ids = feds(); - if ( feds().empty() ) { - ss << "[SiStripFedCabling::" << __func__ << "]" - << " No FEDs found! Unable to print cabling map!"; - return; - } else { - ss << "[SiStripFedCabling::" << __func__ << "]" - << " Printing cabling map for " << fed_ids.size() - << " FEDs with following ids: "; - } - - std::vector::const_iterator ii = fed_ids.begin(); - for ( ; ii != fed_ids.end(); ii++ ) { ss << *ii << " "; } - ss << std::endl << std::endl; - - uint16_t total = 0; - uint16_t nfeds = 0; - uint16_t cntr = 0; - - std::vector::const_iterator ifed = fed_ids.begin(); - for ( ; ifed != fed_ids.end(); ifed++ ) { - const std::vector& conns = connections(*ifed); - - ss << " Printing cabling information for FED id " << *ifed - << " (found " << conns.size() - << " FedChannelConnection objects...)" - << std::endl; - - uint16_t ichan = 0; - uint16_t connected = 0; - std::vector::const_iterator iconn = conns.begin(); - for ( ; iconn != conns.end(); iconn++ ) { - if ( iconn->fedId() != sistrip::invalid_ ) { - connected++; - ss << *iconn << std::endl; - } else { - ss << " (FedId/Ch " << *ifed << "/" << ichan - << ": unconnected channel...)" << std::endl; - cntr++; - } - ichan++; - } - - ss << " Found " << connected - << " connected channels for FED id " << *ifed << std::endl - << std::endl; - if ( connected ) { nfeds++; total += connected; } - - } // fed loop - - float percent = (100.*cntr) / (96.*nfeds); - percent = static_cast( 10.*percent ); - percent /= 10.; - ss << " Found " << total - << " APV pairs that are connected to a total of " - << nfeds << " FEDs" << std::endl - << " " << detected_.size() - << " APV pairs have been detected, but are not connected" << std::endl - << " " << undetected_.size() - << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl - << " " << cntr - << " FED channels out of a possible " << (96*nfeds) - << " (" << nfeds << " FEDs) are unconnected (" - << percent << "%)" << std::endl - << std::endl; - -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::terse( std::stringstream& ss ) const { - - ss << "[SiStripFedCabling::" << __func__ << "]"; - - const std::vector& fed_ids = feds(); - if ( feds().empty() ) { - ss << " No FEDs found! Unable to print cabling map!"; - return; - } - - ss << " Printing cabling map for " << fed_ids.size() - << " FEDs: " << std::endl << std::endl; - - std::vector::const_iterator ifed = fed_ids.begin(); - for ( ; ifed != fed_ids.end(); ifed++ ) { - - const std::vector& conns = connections(*ifed); - - ss << " Printing cabling information for FED id " << *ifed - << " (found " << conns.size() - << " FedChannelConnection objects...)" - << std::endl; - - uint16_t connected = 0; - std::vector::const_iterator iconn = conns.begin(); - for ( ; iconn != conns.end(); iconn++ ) { - if ( iconn->fedId() < sistrip::valid_ ) { - connected++; - iconn->terse(ss); - ss << std::endl; - } - } - - ss << " Found " << connected - << " connected channels for FED id " << *ifed << std::endl - << std::endl; - - } - -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::summary( std::stringstream& ss ) const { - - ss << "[SiStripFedCabling::" << __func__ << "]"; - - const std::vector& fed_ids = feds(); - if ( feds().empty() ) { - ss << " No FEDs found!"; - return; - } - - ss << " Found " << feds().size() << " FEDs" - << " with number of connected channels per front-end unit: " - << std::endl - << " FedId FeUnit1 FeUnit2 FeUnit3 FeUnit4 FeUnit5 FeUnit6 FeUnit7 FeUnit8 Total" - << std::endl; - - uint16_t total = 0; - uint16_t nfeds = 0; - - // iterate through fed ids - std::vector::const_iterator ii = fed_ids.begin(); - std::vector::const_iterator jj = fed_ids.end(); - for ( ; ii != jj; ++ii ) { - - // check number of connection objects - const std::vector& conns = connections(*ii); - if ( conns.size() < 96 ) { - edm::LogError(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Unexpected size for FedChannelConnection vector! " - << conns.size(); - return; - } - - // count connected channels at level of fe unit - std::vector connected; - connected.resize(8,0); - for ( uint16_t ichan = 0; ichan < 96; ++ichan ) { - if ( conns[ichan].fedId() < sistrip::valid_ ) { - uint16_t unit = SiStripFedKey::feUnit(ichan); - if ( unit > 8 ) { continue; } - connected[unit-1]++; - } - } - - // increment counters - uint16_t tot = 0 ; - ss << " " << std::setw(5) << *ii; - if ( !connected.empty() ) { nfeds++; } - for ( uint16_t unit = 0; unit < 8; ++unit ) { - ss << " " << std::setw(7) << connected[unit]; - if ( !connected.empty() ) { tot += connected[unit]; } - } - ss << " " << std::setw(5) << tot << std::endl; - total += tot; - - } - - // print out - float percent = (100.*total) / (96.*nfeds); - percent = static_cast( 10.*percent ); - percent /= 10.; - ss << " Found: " << std::endl - << " " << nfeds << " out of " << feds().size() << " FEDs with at least one connected channel " << std::endl - << " " << feds().size() - nfeds << " out of " << feds().size() << " FEDs with no connected channels." << std::endl - << " " << total << " connected channels in total" << std::endl - << " " << detected_.size() << " APV pairs have been detected, but are not connected" << std::endl - << " " << undetected_.size() << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl - << " " << percent << "% of FED channels are connected" << std::endl; - -} - -// ----------------------------------------------------------------------------- -// -std::ostream& operator<< ( std::ostream& os, const SiStripFedCabling& cabling ) { - std::stringstream ss; - cabling.print(ss); - os << ss.str(); - return os; -} - - -// ----------------------------------------------------------------------------- -#else // SISTRIPCABLING_USING_NEW_STRUCTURE ------------------------------------ -#ifndef SISTRIPCABLING_USING_NEW_INTERFACE // ---------------------------------- -// ----------------------------------------------------------------------------- - - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::SiStripFedCabling( const std::vector& input ) - : feds_(), - registry_(), - connections_(), - detected_(), - undetected_() -{ - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Constructing object..."; - buildFedCabling( input ); -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::SiStripFedCabling( const SiStripFedCabling& input ) - : feds_( input.feds_ ), - registry_( input.registry_ ), - connections_( input.connections_ ), - detected_( input.detected_ ), - undetected_( input.undetected_ ) -{ - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Constructing object..."; -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::SiStripFedCabling() - : feds_(), - registry_(), - connections_(), - detected_(), - undetected_() -{ - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Constructing object..."; -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::~SiStripFedCabling() { - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Destructing object..."; -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::buildFedCabling( const std::vector& input ) { - - // Check input - if ( input.empty() ) { - edm::LogError(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Input vector of FedChannelConnections is of zero size!" - << " Unable to populate FED cabling object!"; - return; - } - - std::stringstream ss; - ss << "[SiStripFedCabling::" << __func__ << "]" - << " Building FED cabling from " - << input.size() - << " connections..."; - LogTrace(mlCabling_) << ss.str(); - - // Sort input vector by FED id and channel - Conns temp(input); - std::sort( temp.begin(), temp.end() ); - - // Strip FED ids - uint16_t min_id = static_cast( FEDNumbering::getSiStripFEDIds().first ); - uint16_t max_id = static_cast( FEDNumbering::getSiStripFEDIds().second ); - uint16_t nfeds = max_id - min_id + 1; - - // Initialise containers - connections_.clear(); - connections_.reserve( 96 * nfeds ); - registry_.clear(); - feds_.clear(); - registry_.resize( nfeds, ConnsRange::emptyPair() ); - - // Populate container - ConnsIter ii = temp.begin(); - ConnsIter jj = temp.end(); - for ( ; ii != jj; ++ii ) { - - uint16_t fed_id = ii->fedId(); - uint16_t fed_ch = ii->fedCh(); - uint16_t index = fed_id - min_id; - - if ( fed_id < min_id || fed_id > max_id ) { continue; } - if ( index >= registry_.size() ) { continue; } - if ( !ii->isConnected() ) { continue; } - - FedsConstIter iter = find( feds_.begin(), feds_.end(), fed_id ); - if ( iter == feds_.end() ) { feds_.push_back( fed_id ); } - - if ( registry_[index] == ConnsRange::emptyPair() ) { - ConnsPair conns_pair; - conns_pair.first = std::distance( connections_.begin(), connections_.end() ); - connections_.insert( connections_.end(), 96, FedChannelConnection() ); - conns_pair.second = std::distance( connections_.begin(), connections_.end() ); - registry_[index] = conns_pair; - } - - ConnsRange conns = range( registry_[index] ); - ConnsConstIter iconn = conns.begin() + fed_ch; - FedChannelConnection& conn = const_cast(*iconn); - conn = *ii; - - } - -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::ConnsRange::ConnsRange( const Conns& c, ConnsPair p ) : - vector_( c.begin(), c.end() ), - range_( c.begin()+p.first, c.begin()+p.second ) -{ - if ( p.first > p.second || - p.first == sistrip::invalid32_ || - p.second == sistrip::invalid32_ || - p.first > c.size() || - p.second > c.size() ) { - range_ = ConnsConstIterRange( c.end(), c.end() ); - } -} - -// ----------------------------------------------------------------------------- -// -SiStripFedCabling::ConnsRange::ConnsRange( const Conns& c ) : - vector_( c.begin(), c.end() ), - range_( c.end(), c.end() ) -{;} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::ConnsRange::print( std::stringstream& ss ) const { - ss << "[SiStripFedCabling::ConnsRange::" << __func__ << "] Debug info:" << std::endl - << " Vector : " << std::endl - << " size : " << vector_.size() << std::endl - << " begin : " - << std::hex << std::setfill('0') << std::setw(8) - << &*vector_.begin() - << std::dec << std::endl - << " end : " - << std::hex << std::setfill('0') << std::setw(8) - << &*vector_.end() - << std::dec << std::endl - << " Range : " << std::endl - << " size : " << range_.size() << std::endl - << " begin : " - << std::hex << std::setfill('0') << std::setw(8) - << &*range_.begin() - << std::dec - << " (dist=" << std::distance( vector_.begin(), range_.begin() ) << ")" - << std::endl - << " end : " - << std::hex << std::setfill('0') << std::setw(8) - << &*range_.end() - << std::dec - << " (dist=" << std::distance( vector_.begin(), range_.end() ) << ")" - << std::endl - << " Offsets : " << std::endl - << " first : " << connsPair().first << std::endl - << " second : " << connsPair().second << std::endl; -} - -// ----------------------------------------------------------------------------- -// -std::ostream& operator<<( std::ostream& os, const SiStripFedCabling::ConnsRange& input ) { - std::stringstream ss; - input.print(ss); - os << ss.str(); - return os; -} - -// ----------------------------------------------------------------------------- -// Returns connection info for FE devices connected to given FED -const std::vector& SiStripFedCabling::connections( uint16_t fed_id ) const { - - // HORRIBLE! - - static FedChannelConnection conn; - static std::vector conns1(96,conn); - static std::vector conns2(96,conn); - - if ( fed_id < FEDNumbering::getSiStripFEDIds().first || - fed_id > FEDNumbering::getSiStripFEDIds().second ) { return conns1; } - - uint16_t index = fed_id - FEDNumbering::getSiStripFEDIds().first; - if ( index < registry_.size() ) { - ConnsRange conns = range( registry_[ index ] ); - conns2.resize( conns.size() ); - std::copy( conns.begin(), conns.end(), conns2.begin() ); - return conns2; - } else { return conns1; } - -} - -// ----------------------------------------------------------------------------- -// Returns active FEDs -const std::vector& SiStripFedCabling::feds() const { - return feds_; -} - -// ----------------------------------------------------------------------------- -// Returns connection info for FE devices connected to given FED id and channel -const FedChannelConnection& SiStripFedCabling::connection( uint16_t fed_id, - uint16_t fed_ch ) const { - - // HORRIBLE! - - static FedChannelConnection conn; - - if ( fed_id < FEDNumbering::getSiStripFEDIds().first || - fed_id > FEDNumbering::getSiStripFEDIds().second ) { return conn; } - - uint16_t index = fed_id - FEDNumbering::getSiStripFEDIds().first; - if ( index < registry_.size() ) { - ConnsRange conns = range( registry_[ index ] ); - if ( conns.size() != 96 ) { return conn; } - else if ( fed_ch > 95 ) { return conn; } - else { return *( conns.begin() + fed_ch ); } - } else { return conn; } - -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::print( std::stringstream& ss ) const { - - uint16_t total = 0; - uint16_t nfeds = 0; - uint16_t cntr = 0; - - if ( feds_.empty() ) { - ss << "[SiStripFedCabling::" << __func__ << "]" - << " No FEDs found! Unable to print cabling map!"; - return; - } else { - ss << "[SiStripFedCabling::" << __func__ << "]" - << " Printing cabling map for " << feds_.size() - << " FEDs with following ids: "; - } - - std::vector::const_iterator ii = feds_.begin(); - std::vector::const_iterator jj = feds_.end(); - for ( ; ii != jj; ++ii ) { ss << *ii << " "; } - ss << std::endl << std::endl; - - std::vector::const_iterator ifed = feds_.begin(); - std::vector::const_iterator jfed = feds_.end(); - for ( ; ifed != jfed; ++ifed ) { - - uint16_t index = *ifed - FEDNumbering::getSiStripFEDIds().first; - if ( index < registry_.size() ) { - ConnsRange conns = range( registry_[ index ] ); - - ss << " Printing cabling information for FED id " << *ifed - << " (found " << conns.size() - << " FedChannelConnection objects...)" - << std::endl; - - uint16_t ichan = 0; - uint16_t connected = 0; - ConnsConstIter iconn = conns.begin(); - ConnsConstIter jconn = conns.end(); - for ( ; iconn != jconn; ++iconn ) { - if ( iconn->fedId() != sistrip::invalid_ ) { - connected++; - ss << *iconn << std::endl; - } else { - ss << " (FedId/Ch " << *ifed << "/" << ichan - << ": unconnected channel...)" << std::endl; - cntr++; - } - ichan++; - } - - ss << " Found " << connected - << " connected channels for FED id " << *ifed << std::endl - << std::endl; - if ( connected ) { nfeds++; total += connected; } - - } - - } - - float percent = (100.*cntr) / (96.*nfeds); - percent = static_cast( 10.*percent ); - percent /= 10.; - ss << " Found " << total - << " APV pairs that are connected to a total of " - << nfeds << " FEDs" << std::endl - << " " << detected_.size() - << " APV pairs have been detected, but are not connected" << std::endl - << " " << undetected_.size() - << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl - << " " << cntr - << " FED channels out of a possible " << (96*nfeds) - << " (" << nfeds << " FEDs) are unconnected (" - << percent << "%)" << std::endl - << std::endl; - -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::terse( std::stringstream& ss ) const { - - - ss << "[SiStripFedCabling::" << __func__ << "]"; - - if ( feds_.empty() ) { - ss << " No FEDs found! Unable to print cabling map!"; - return; - } - - ss << " Printing cabling map for " << feds_.size() - << " FEDs: " << std::endl << std::endl; - - std::vector::const_iterator ifed = feds_.begin(); - std::vector::const_iterator jfed = feds_.end(); - for ( ; ifed != jfed; ++ifed ) { - - uint16_t index = *ifed - FEDNumbering::getSiStripFEDIds().first; - if ( index < registry_.size() ) { - ConnsRange conns = range( registry_[ index ] ); - - ss << " Printing cabling information for FED id " << *ifed - << " (found " << conns.size() - << " FedChannelConnection objects...)" - << std::endl; - - uint16_t connected = 0; - ConnsConstIter iconn = conns.begin(); - ConnsConstIter jconn = conns.end(); - for ( ; iconn != jconn; ++iconn ) { - if ( iconn->fedId() != sistrip::invalid_ ) { - connected++; - iconn->terse(ss); - ss << std::endl; - } - } - - ss << " Found " << connected - << " connected channels for FED id " << *ifed << std::endl - << std::endl; - - } - - } - -} - -// ----------------------------------------------------------------------------- -// -void SiStripFedCabling::summary( std::stringstream& ss ) const { - - ss << "[SiStripFedCabling::" << __func__ << "]"; - - if ( feds_.empty() ) { - ss << " No FEDs found!"; - return; - } - - ss << " Found " << feds_.size() << " FEDs" - << " with number of connected channels per front-end unit: " - << std::endl - << " FedId FeUnit1 FeUnit2 FeUnit3 FeUnit4 FeUnit5 FeUnit6 FeUnit7 FeUnit8 Total" - << std::endl; - - uint16_t total = 0; - uint16_t nfeds = 0; - - // iterate through fed ids - std::vector::const_iterator ii = feds_.begin(); - std::vector::const_iterator jj = feds_.end(); - for ( ; ii != jj; ++ii ) { - - // check number of connection objects - uint16_t index = *ii - FEDNumbering::getSiStripFEDIds().first; - if ( index < registry_.size() ) { - ConnsRange conns = range( registry_[ index ] ); - - if ( conns.size() < 96 ) { - edm::LogError(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Unexpected size for FedChannelConnection vector! " - << conns.size(); - return; - } - - // count connected channels at level of fe unit - std::vector connected; - connected.resize(8,0); - for ( uint16_t ichan = 0; ichan < 96; ++ichan ) { - ConnsConstIter iconn = conns.begin() + ichan; - if ( iconn->fedId() < sistrip::valid_ ) { - uint16_t unit = SiStripFedKey::feUnit(ichan); - if ( unit > 8 ) { continue; } - connected[unit-1]++; - } - } - - // increment counters - uint16_t tot = 0 ; - ss << " " << std::setw(5) << *ii; - if ( !connected.empty() ) { nfeds++; } - for ( uint16_t unit = 0; unit < 8; ++unit ) { - ss << " " << std::setw(7) << connected[unit]; - if ( !connected.empty() ) { tot += connected[unit]; } - } - ss << " " << std::setw(5) << tot << std::endl; - total += tot; - - } - - } - - // print out - float percent = (100.*total) / (96.*nfeds); - percent = static_cast( 10.*percent ); - percent /= 10.; - ss << " Found: " << std::endl - << " " << nfeds << " out of " << feds_.size() - << " FEDs with at least one connected channel " << std::endl - << " " << feds_.size() - nfeds << " out of " << feds_.size() - << " FEDs with no connected channels." << std::endl - << " " << total << " connected channels in total" << std::endl - << " " << detected_.size() - << " APV pairs have been detected, but are not connected" << std::endl - << " " << undetected_.size() - << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl - << " " << percent - << "% of FED channels are connected" << std::endl; - -} - -// ----------------------------------------------------------------------------- -// -std::ostream& operator<< ( std::ostream& os, const SiStripFedCabling& cabling ) { - std::stringstream ss; - cabling.print(ss); - os << ss.str(); - return os; -} - - -// ----------------------------------------------------------------------------- -#else // SISTRIPCABLING_USING_NEW_INTERFACE ------------------------------------ -// ----------------------------------------------------------------------------- - - -// ----------------------------------------------------------------------------- -// TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! -SiStripFedCabling::SiStripFedCabling( const std::vector& input ) - : feds_(), - registry_(), - connections_(), - detected_(), - undetected_() -{ - LogTrace(mlCabling_) - << "[SiStripFedCabling::" << __func__ << "]" - << " Constructing object for vector of connections..."; - buildFedCabling( ConnsConstIterRange( input.begin(), - input.end() ) ); -} - -// ----------------------------------------------------------------------------- -// TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! -void SiStripFedCabling::buildFedCabling( const std::vector& input ) { - buildFedCabling( ConnsConstIterRange( input.begin(), - input.end() ) ); -} - -// ----------------------------------------------------------------------------- -// TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! -const std::vector& SiStripFedCabling::connections( uint16_t fed_id ) const { - static std::vector output; - output.clear(); - ConnsConstIterRange input = fedConnections( fed_id ); - if ( !input.empty() ) { - output.resize( input.size() ); - std::copy( input.begin(), input.end(), output.begin() ); - } else { output.resize( 96, FedChannelConnection() ); } - return output; -} - -// ----------------------------------------------------------------------------- -// TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! -const FedChannelConnection& SiStripFedCabling::connection( uint16_t fed_id, - uint16_t fed_ch ) const { - const static FedChannelConnection output = fedConnection( fed_id, fed_ch ); - return output; -} - -// ----------------------------------------------------------------------------- -// TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! -const std::vector& SiStripFedCabling::feds() const { - return feds_; -} - -// ----------------------------------------------------------------------------- -// TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! -const std::vector& SiStripFedCabling::detected() const { - return detected_; -} - -// ----------------------------------------------------------------------------- -// TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED! -const std::vector& SiStripFedCabling::undetected() const{ - return undetected_; -} - // ----------------------------------------------------------------------------- // SiStripFedCabling::SiStripFedCabling( ConnsConstIterRange input ) @@ -1394,9 +432,3 @@ std::ostream& operator<< ( std::ostream& os, const SiStripFedCabling& cabling ) os << ss.str(); return os; } - - -// ----------------------------------------------------------------------------- -#endif // SISTRIPCABLING_USING_NEW_INTERFACE ----------------------------------- -#endif // SISTRIPCABLING_USING_NEW_STRUCTURE ----------------------------------- -// ----------------------------------------------------------------------------- diff --git a/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc b/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc index e84380af9cf9c..3ce18c7277d6a 100644 --- a/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc +++ b/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc @@ -965,10 +965,10 @@ TrackerDpgAnalysis::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup // cabling I (readout) iSetup.get().get( cabling_ ); - const std::vector< uint16_t > & feds = cabling_->feds() ; - for(std::vector< uint16_t >::const_iterator fedid = feds.begin();fedid & connections = cabling_->connections(*fedid); - for(std::vector< FedChannelConnection >::const_iterator conn=connections.begin();connfedIds() ; + for(auto fedid = feds.begin();fedidfedConnections(*fedid); + for(auto conn=connections.begin();connisConnected()) connections_.insert(std::make_pair(conn->detId(),new FedChannelConnection(*conn))); diff --git a/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc index 1dca017553383..4ad8d018c6949 100644 --- a/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc @@ -284,12 +284,11 @@ bool ApvTimingHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange de void ApvTimingHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds ) { // Retrieve FED ids from cabling - std::vector ids = cabling()->feds(); + auto ids = cabling()->fedIds(); // Iterate through feds and update fed descriptions uint16_t updated = 0; - SiStripConfigDb::FedDescriptionsV::const_iterator ifed; - for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { + for ( auto ifed = feds.begin(); ifed != feds.end(); ++ifed ) { // If FED id not found in list (from cabling), then continue if ( find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) { continue; } @@ -297,7 +296,7 @@ void ApvTimingHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { // Build FED and FEC keys - const FedChannelConnection& conn = cabling()->connection( (*ifed)->getFedId(), ichan ); + const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan ); if ( conn.fecCrate() == sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ || conn.fecRing() == sistrip::invalid_ || diff --git a/DQM/SiStripCommissioningDbClients/src/CommissioningHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/CommissioningHistosUsingDb.cc index 3a516e912a3df..b0217d2dd31f9 100644 --- a/DQM/SiStripCommissioningDbClients/src/CommissioningHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/CommissioningHistosUsingDb.cc @@ -207,8 +207,8 @@ void CommissioningHistosUsingDb::addDcuDetIds() { SiStripFedKey fed_key = anal->fedKey(); SiStripFecKey fec_key = anal->fecKey(); - FedChannelConnection conn = cabling_->connection( fed_key.fedId(), - fed_key.fedChannel() ); + FedChannelConnection conn = cabling_->fedConnection( fed_key.fedId(), + fed_key.fedChannel() ); SiStripFedKey fed( conn.fedId(), SiStripFedKey::feUnit( conn.fedCh() ), diff --git a/DQM/SiStripCommissioningDbClients/src/FineDelayHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/FineDelayHistosUsingDb.cc index 607ab6374475f..b1896cb234a71 100644 --- a/DQM/SiStripCommissioningDbClients/src/FineDelayHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/FineDelayHistosUsingDb.cc @@ -140,13 +140,13 @@ void FineDelayHistosUsingDb::computeDelays() { } // Retrieve FED ids from cabling - std::vector ids = cabling()->feds() ; + auto ids = cabling()->fedIds() ; // loop over the FED ids - for (std::vector::const_iterator ifed = ids.begin(); ifed != ids.end(); ++ifed) { - const std::vector& conns = cabling()->connections(*ifed); + for (auto ifed = ids.begin(); ifed != ids.end(); ++ifed) { + auto conns = cabling()->fedConnections(*ifed); // loop over the connections for that FED - for ( std::vector::const_iterator iconn = conns.begin(); iconn != conns.end(); iconn++ ) { + for ( auto iconn = conns.begin(); iconn != conns.end(); ++iconn ) { // check that this is a tracker module if(DetId(iconn->detId()).det()!=DetId::Tracker) continue; // retrieve the position of that module in the tracker using the geometry @@ -286,15 +286,15 @@ void FineDelayHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds computeDelays(); // Retrieve FED ids from cabling - std::vector ids = cabling()->feds() ; + auto ids = cabling()->fedIds() ; // loop over the FED ids for ( SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // If FED id not found in list (from cabling), then continue if ( find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) { continue; } - const std::vector& conns = cabling()->connections((*ifed)->getFedId()); + auto conns = cabling()->fedConnections((*ifed)->getFedId()); // loop over the connections for that FED - for ( std::vector::const_iterator iconn = conns.begin(); iconn != conns.end(); iconn++ ) { + for ( auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) { // check that this is a tracker module if(DetId(iconn->detId()).det()!=DetId::Tracker) continue; // build the Fed9UAddress for that channel. Used to update the description. diff --git a/DQM/SiStripCommissioningDbClients/src/LatencyHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/LatencyHistosUsingDb.cc index 056779fde64e8..40e7ac233b1f2 100644 --- a/DQM/SiStripCommissioningDbClients/src/LatencyHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/LatencyHistosUsingDb.cc @@ -238,18 +238,18 @@ bool LatencyHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange devi } // Retrieve FED ids from cabling - std::vector ids = cabling()->feds() ; + auto ids = cabling()->fedIds() ; // loop over the FED ids to determine min and max values of coarse delay uint16_t minDelay = 256; uint16_t maxDelay = 0; uint16_t fedDelayCoarse = 0; - for ( SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++ ) { + for ( auto ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // If FED id not found in list (from cabling), then continue if ( find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) { continue; } - const std::vector& conns = cabling()->connections((*ifed)->getFedId()); + auto conns = cabling()->fedConnections((*ifed)->getFedId()); // loop over the connections for that FED - for ( std::vector::const_iterator iconn = conns.begin(); iconn != conns.end(); iconn++ ) { + for ( auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) { // check that this is a tracker module if(DetId(iconn->detId()).det()!=DetId::Tracker) continue; // build the Fed9UAddress for that channel. Used to update the description. @@ -270,9 +270,9 @@ bool LatencyHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange devi for ( SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // If FED id not found in list (from cabling), then continue if ( find( ids.begin(), ids.end(), (*ifed)->getFedId() ) == ids.end() ) { continue; } - const std::vector& conns = cabling()->connections((*ifed)->getFedId()); + auto conns = cabling()->fedConnections((*ifed)->getFedId()); // loop over the connections for that FED - for ( std::vector::const_iterator iconn = conns.begin(); iconn != conns.end(); iconn++ ) { + for ( auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) { // check that this is a tracker module if(DetId(iconn->detId()).det()!=DetId::Tracker) continue; // build the Fed9UAddress for that channel. Used to update the description. diff --git a/DQM/SiStripCommissioningDbClients/src/NoiseHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/NoiseHistosUsingDb.cc index 89b33400c1040..af99df24f73b8 100644 --- a/DQM/SiStripCommissioningDbClients/src/NoiseHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/NoiseHistosUsingDb.cc @@ -81,7 +81,7 @@ void NoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds ) { for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { // Build FED and FEC keys - const FedChannelConnection& conn = cabling()->connection( (*ifed)->getFedId(), ichan ); + const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan ); if ( conn.fecCrate() == sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ || conn.fecRing() == sistrip::invalid_ || diff --git a/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc index 3d7309c4cd317..3827255d879cd 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc @@ -93,7 +93,7 @@ void PedestalsHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { // Build FED and FEC keys - const FedChannelConnection& conn = cabling()->connection( (*ifed)->getFedId(), ichan ); + const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan ); if ( conn.fecCrate() == sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ || conn.fecRing() == sistrip::invalid_ || diff --git a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc index 708f18cb48051..b318d3f2c56d9 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc @@ -94,7 +94,7 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { // Build FED and FEC keys - const FedChannelConnection& conn = cabling()->connection( (*ifed)->getFedId(), ichan ); + const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan ); if ( conn.fecCrate()== sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ || conn.fecRing() == sistrip::invalid_ || diff --git a/DQM/SiStripCommissioningDbClients/src/PedsOnlyHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedsOnlyHistosUsingDb.cc index 585be7c8e041b..76907a2b23b45 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedsOnlyHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedsOnlyHistosUsingDb.cc @@ -81,7 +81,7 @@ void PedsOnlyHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds ) for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { // Build FED and FEC keys - const FedChannelConnection& conn = cabling()->connection( (*ifed)->getFedId(), ichan ); + const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan ); if ( conn.fecCrate() == sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ || conn.fecRing() == sistrip::invalid_ || diff --git a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc index dacca7c30aa89..3c6f7944d861c 100644 --- a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc +++ b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayHit.cc @@ -569,9 +569,9 @@ SiStripFineDelayHit::beginRun(const edm::Run & run, const edm::EventSetup & iSet // Retrieve FED cabling object edm::ESHandle cabling; iSetup.get().get( cabling ); - const std::vector< uint16_t > & feds = cabling->feds() ; - for(std::vector< uint16_t >::const_iterator fedid = feds.begin();fedid & connections = cabling->connections(*fedid); + auto feds = cabling->fedIds() ; + for( auto fedid = feds.begin();fedidfedConnections(*fedid); for(std::vector< FedChannelConnection >::const_iterator conn=connections.begin();connfedId(), diff --git a/DQM/SiStripCommissioningSources/src/SiStripCommissioningSource.cc b/DQM/SiStripCommissioningSources/src/SiStripCommissioningSource.cc index 80370c752e36f..1f958fa38ea57 100644 --- a/DQM/SiStripCommissioningSources/src/SiStripCommissioningSource.cc +++ b/DQM/SiStripCommissioningSources/src/SiStripCommissioningSource.cc @@ -136,7 +136,7 @@ void SiStripCommissioningSource::beginRun( edm::Run const & run, const edm::Even fedCabling_ = const_cast( fed_cabling.product() ); LogDebug(mlDqmSource_) << "[SiStripCommissioningSource::" << __func__ << "]" - << "Initialized FED cabling. Number of FEDs is " << fedCabling_->feds().size(); + << "Initialized FED cabling. Number of FEDs is " << fedCabling_->fedIds().size(); fecCabling_ = new SiStripFecCabling( *fed_cabling ); if ( fecCabling_->crates().empty() ) { std::stringstream ss; @@ -183,11 +183,10 @@ void SiStripCommissioningSource::endJob() { // All tasks except cabling uint16_t fed_id = 0; uint16_t fed_ch = 0; - std::vector::const_iterator ifed = fedCabling_->feds().begin(); - for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { - const std::vector& conns = fedCabling_->connections(*ifed); - std::vector::const_iterator iconn = conns.begin(); - for ( ; iconn != conns.end(); iconn++ ) { + auto ifed = fedCabling_->fedIds().begin(); + for ( ; ifed != fedCabling_->fedIds().end(); ifed++ ) { + auto conns = fedCabling_->fedConnections(*ifed); + for ( auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) { if ( !iconn->isConnected() ) { continue; } fed_id = iconn->fedId(); fed_ch = iconn->fedCh(); @@ -409,8 +408,7 @@ void SiStripCommissioningSource::fillCablingHistos( const SiStripEventSummary* c } // Iterate through FED ids - std::vector::const_iterator ifed = fedCabling_->feds().begin(); - for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { + for (auto ifed = fedCabling_->fedIds().begin() ; ifed != fedCabling_->fedIds().end(); ifed++ ) { // Check if FedId is non-zero if ( *ifed == sistrip::invalid_ ) { continue; } @@ -606,13 +604,12 @@ void SiStripCommissioningSource::fillHistos( const SiStripEventSummary* const su const edm::DetSetVector& raw ) { // Iterate through FED ids and channels - std::vector::const_iterator ifed = fedCabling_->feds().begin(); - for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { + auto ifed = fedCabling_->fedIds().begin(); + for ( ; ifed != fedCabling_->fedIds().end(); ifed++ ) { // Iterate through connected FED channels - const std::vector& conns = fedCabling_->connections(*ifed); - std::vector::const_iterator iconn = conns.begin(); - for ( ; iconn != conns.end(); iconn++ ) { + auto conns = fedCabling_->fedConnections(*ifed); + for (auto iconn = conns.begin() ; iconn != conns.end(); iconn++ ) { if ( !(iconn->fedId()) || iconn->fedId() > sistrip::valid_ ) { continue; } @@ -963,15 +960,13 @@ void SiStripCommissioningSource::createTasks( sistrip::RunType run_type, const e } else { // now do any other task // Iterate through FED ids and channels - std::vector::const_iterator ifed = fedCabling_->feds().begin(); - for ( ; ifed != fedCabling_->feds().end(); ifed++ ) { + for (auto ifed = fedCabling_->fedIds().begin() ; ifed != fedCabling_->fedIds().end(); ++ifed ) { // Iterate through connected FED channels // S.L.: currently copy the vector, because it changes later when // reading in peds for calibration run -> not understood memory corruption! - std::vector conns = fedCabling_->connections(*ifed); - std::vector::const_iterator iconn = conns.begin(); - for ( ; iconn != conns.end(); iconn++ ) { + auto conns = fedCabling_->fedConnections(*ifed); + for (auto iconn = conns.begin() ; iconn != conns.end(); ++iconn ) { // Create FEC key SiStripFecKey fec_key( iconn->fecCrate(), diff --git a/DQM/SiStripCommissioningSummary/src/ViewTranslator.cc b/DQM/SiStripCommissioningSummary/src/ViewTranslator.cc index 2f47605b23072..75cb55d1270e1 100644 --- a/DQM/SiStripCommissioningSummary/src/ViewTranslator.cc +++ b/DQM/SiStripCommissioningSummary/src/ViewTranslator.cc @@ -25,12 +25,10 @@ void ViewTranslator::buildMaps( const SiStripFedCabling& cabling, // } // Iterator through cabling, construct keys and push back into std::map - std::vector::const_iterator ifed = cabling.feds().begin(); - for ( ; ifed != cabling.feds().end(); ifed++ ) { + for ( auto ifed = cabling.fedIds().begin() ; ifed != cabling.fedIds().end(); ++ifed ) { - const std::vector& conns = cabling.connections( *ifed ); - std::vector::const_iterator ichan; - for( ichan = conns.begin(); ichan != conns.end(); ichan++ ) { + auto conns = cabling.fedConnections( *ifed ); + for( auto ichan = conns.begin(); ichan != conns.end(); ichan++ ) { if( ichan->fedId() ) { uint32_t fed = SiStripFedKey( *ifed, diff --git a/DQM/SiStripMonitorClient/src/SiStripDaqInfo.cc b/DQM/SiStripMonitorClient/src/SiStripDaqInfo.cc index 091522bd1439b..aadf6f7068ebd 100644 --- a/DQM/SiStripMonitorClient/src/SiStripDaqInfo.cc +++ b/DQM/SiStripMonitorClient/src/SiStripDaqInfo.cc @@ -182,12 +182,12 @@ void SiStripDaqInfo::readFedIds(const edm::ESHandle& fedcabli iSetup.get().get(tTopoHandle); const TrackerTopology* const tTopo = tTopoHandle.product(); - const std::vector& feds = fedCabling_->feds(); + auto feds = fedCabling_->fedIds(); nFedTotal = feds.size(); for(std::vector::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++){ - const std::vector fedChannels = fedCabling_->connections( *ifed ); - for (std::vector::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){ + auto fedChannels = fedCabling_->fedConnections( *ifed ); + for (auto iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){ if (!iconn->isConnected()) continue; uint32_t detId = iconn->detId(); if (detId == 0 || detId == 0xFFFFFFFF) continue; @@ -261,7 +261,7 @@ void SiStripDaqInfo::findExcludedModule(unsigned short fed_id, const TrackerTopo dqmStore_->setCurrentFolder("SiStrip/"+mdir); } std::string mechanical_dir = dqmStore_->pwd(); - const std::vector fedChannels = fedCabling_->connections(fed_id); + auto fedChannels = fedCabling_->fedConnections(fed_id); int ichannel = 0; std::string tag = "ExcludedFedChannel"; std::string bad_module_folder; diff --git a/DQM/SiStripMonitorHardware/src/FEDErrors.cc b/DQM/SiStripMonitorHardware/src/FEDErrors.cc index 86ca251ad5ac3..e98a9bde91ff6 100644 --- a/DQM/SiStripMonitorHardware/src/FEDErrors.cc +++ b/DQM/SiStripMonitorHardware/src/FEDErrors.cc @@ -120,7 +120,7 @@ void FEDErrors::initialiseFED(const unsigned int aFedID, iCh < sistrip::FEDCH_PER_FED; iCh++) { - const FedChannelConnection & lConnection = aCabling->connection(fedID_,iCh); + const FedChannelConnection & lConnection = aCabling->fedConnection(fedID_,iCh); connected_[iCh] = lConnection.isConnected(); detid_[iCh] = lConnection.detId(); nChInModule_[iCh] = lConnection.nApvPairs(); @@ -318,7 +318,7 @@ float FEDErrors::fillNonFatalFEDErrors(const sistrip::FEDBuffer* aBuffer, for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) {//loop on channels bool lIsConnected = false; if (aCabling) { - const FedChannelConnection & lConnection = aCabling->connection(fedID_,iCh); + const FedChannelConnection & lConnection = aCabling->fedConnection(fedID_,iCh); lIsConnected = lConnection.isConnected(); } else lIsConnected = connected_[iCh]; diff --git a/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc b/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc index 1dee10744b1f5..15f137bbb2880 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc @@ -257,7 +257,7 @@ SiStripCMMonitorPlugin::analyze(const edm::Event& iEvent, iCh < sistrip::FEDCH_PER_FED; iCh++) {//loop on channels - const FedChannelConnection & lConnection = cabling_->connection(fedId,iCh); + const FedChannelConnection & lConnection = cabling_->fedConnection(fedId,iCh); bool connected = lConnection.isConnected(); //std::cout << "FedID " << fedId << ", ch " << iCh << ", nAPVPairs " << lConnection.nApvPairs() << " apvPairNumber " << lConnection.apvPairNumber() << std::endl; diff --git a/DQM/SiStripMonitorHardware/src/SiStripFEDEmulatorModule.cc b/DQM/SiStripMonitorHardware/src/SiStripFEDEmulatorModule.cc index 0eb23afc73d90..1c9b1fa98a354 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripFEDEmulatorModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripFEDEmulatorModule.cc @@ -218,7 +218,7 @@ namespace sistrip { uint16_t lFedChannel = 0; sistrip::SpyUtilities::fedIndex(lDetId, lFedId, lFedChannel); - const FedChannelConnection & lConnection = lCabling->connection(lFedId,lFedChannel); + const FedChannelConnection & lConnection = lCabling->fedConnection(lFedId,lFedChannel); lDetId = lConnection.detId(); lNPairs = lConnection.nApvPairs(); lPair = lConnection.apvPairNumber(); diff --git a/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc b/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc index a2d65ebebf810..4d3c679ac6ee4 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc @@ -137,7 +137,7 @@ SiStripShotFilter::filter(edm::Event& iEvent, iCh < sistrip::FEDCH_PER_FED; iCh++) {//loop on channels - const FedChannelConnection & lConnection = cabling_->connection(fedId,iCh); + const FedChannelConnection & lConnection = cabling_->fedConnection(fedId,iCh); uint32_t lDetId = lConnection.detId(); short lAPVPair = lConnection.apvPairNumber(); diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc index 2a6d5395c3681..d8581aa0d497f 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc @@ -214,13 +214,13 @@ namespace sistrip { RawDigiDetSetVectorFiller dsvFiller(nFeds*FEDCH_PER_FED/2, nFeds*FEDCH_PER_FED*STRIPS_PER_FEDCH); // Loop over FEDs in cabling - std::vector::const_iterator iFed = cabling.feds().begin(); - const std::vector::const_iterator endFeds = cabling.feds().end(); + auto iFed = cabling.fedIds().begin(); + auto endFeds = cabling.fedIds().end(); for (; iFed != endFeds; ++iFed) { // Loop over cabled channels - const std::vector& conns = cabling.connections(*iFed); - std::vector::const_iterator iConn = conns.begin(); - const std::vector::const_iterator endConns = conns.end(); + auto conns = cabling.fedConnections(*iFed); + auto iConn = conns.begin(); + auto endConns = conns.end(); for (; iConn != endConns; ++iConn) { // Skip channels not connected to a detector. if (!iConn->isConnected()) continue; diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc index 459ff31bcaf40..5154341d814f8 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc @@ -325,8 +325,8 @@ namespace sistrip { } if (inputVirginRawDigis) { std::set fedDetIds; - const std::vector& conns = cabling.connections(fedId); - for (std::vector::const_iterator iConn = conns.begin(); iConn != conns.end(); ++iConn) { + auto conns = cabling.fedConnections(fedId); + for (auto iConn = conns.begin(); iConn != conns.end(); ++iConn) { if (!iConn->isConnected()) continue; const uint32_t detId = iConn->detId(); if (usedDetIds.find(detId) != usedDetIds.end()) { diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc index 96abc00366016..38753771b4663 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc @@ -111,7 +111,7 @@ namespace sistrip { // event.getByLabel(primaryStreamRawDataTag_,fedRawDataHandle); event.getByToken(primaryStreamRawDataToken_,fedRawDataHandle); const FEDRawDataCollection& fedRawData = *fedRawDataHandle; - for (std::vector::const_iterator iFedId = cabling.feds().begin(); iFedId != cabling.feds().end(); ++iFedId) { + for (auto iFedId = cabling.fedIds().begin(); iFedId != cabling.fedIds().end(); ++iFedId) { const FEDRawData& data = fedRawData.FEDData(*iFedId); if ( (!data.data()) || (!data.size()) ) { LogDebug(messageLabel_) << "Failed to get FED data for FED ID " << *iFedId; @@ -137,8 +137,8 @@ namespace sistrip { continue; } const FEDFullDebugHeader* header = dynamic_cast(buffer->feHeader()); - const std::vector& connections = cabling.connections(*iFedId); - for (std::vector::const_iterator iConn = connections.begin(); iConn != connections.end(); ++iConn) { + auto connections = cabling.fedConnections(*iFedId); + for (auto iConn = connections.begin(); iConn != connections.end(); ++iConn) { if (!iConn->isConnected()) { continue; } diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc index 7ba1e3f085d4e..d97233310acdf 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc @@ -238,7 +238,7 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, lOutCabling.open("trackerDetId_FEDIdChNum_list.txt",std::ios::out); for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) {//loop on feds for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++){//loop on channels - const FedChannelConnection & lConnection = lCabling->connection(lFedId,lFedChannel); + const FedChannelConnection & lConnection = lCabling->fedConnection(lFedId,lFedChannel); if (!lConnection.isConnected()) continue; uint32_t lDetId = lConnection.detId(); lOutCabling << "FED ID = " << lFedId @@ -358,7 +358,7 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, uint32_t lFedIndex = sistrip::FEDCH_PER_FED*lFedId + lFedChannel; - const FedChannelConnection & lConnection = lCabling->connection(lFedId,lFedChannel); + const FedChannelConnection & lConnection = lCabling->fedConnection(lFedId,lFedChannel); if (!lConnection.isConnected()) continue; diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyUnpacker.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyUnpacker.cc index c0e1411aee835..49eafca1107ea 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyUnpacker.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyUnpacker.cc @@ -63,7 +63,7 @@ namespace sistrip { //check if FEDs found in cabling map and event data if ( edm::isDebugEnabled() ) { - if ( cabling.feds().empty() ) { + if ( cabling.fedIds().empty() ) { edm::LogWarning("SiStripSpyUnpacker") << "[sistrip::SpyUnpacker::" << __func__ << "]" << " No FEDs found in cabling map!"; @@ -121,7 +121,7 @@ namespace sistrip { } //get the cabling connections for this FED - const std::vector& conns = cabling.connections(lFedId); + auto conns = cabling.fedConnections(lFedId); //construct FEDBuffer std::auto_ptr buffer; diff --git a/DQMOffline/CalibTracker/plugins/SiStripFEDErrorsDQM.cc b/DQMOffline/CalibTracker/plugins/SiStripFEDErrorsDQM.cc index 8bffdc9b11bd6..5b7122d4b97f9 100644 --- a/DQMOffline/CalibTracker/plugins/SiStripFEDErrorsDQM.cc +++ b/DQMOffline/CalibTracker/plugins/SiStripFEDErrorsDQM.cc @@ -115,15 +115,15 @@ bool SiStripFEDErrorsDQM::readBadAPVs(){ edm::LogError("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] cabling not filled, return false " << std::endl; return false; } - const std::vector& lFedVec = cabling_->feds(); + auto lFedVec = cabling_->fedIds(); for (unsigned int iFed(0);iFed sistrip::FED_ID_MAX) { - edm::LogError("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] Invalid fedid : " << lFedVec.at(iFed) << std::endl; + if (*(lFedVec.begin() + iFed) < sistrip::FED_ID_MIN || *(lFedVec.begin() + iFed) > sistrip::FED_ID_MAX) { + edm::LogError("SiStripFEDErrorsDQM") << "[SiStripFEDErrorsDQM::readBadAPVs] Invalid fedid : " << *(lFedVec.begin() + iFed) << std::endl; continue; } - const std::vector& lConnVec = cabling_->connections(lFedVec.at(iFed)); + auto lConnVec = cabling_->fedConnections(*(lFedVec.begin() + iFed)); for (unsigned int iConn(0); iConnconnection(lFedId,iChId); + const FedChannelConnection & lConnection = cabling_->fedConnection(lFedId,iChId); if (!lConnection.isConnected()) continue; addBadAPV(lConnection,0,lFlag,aCounter); } @@ -311,7 +311,7 @@ void SiStripFEDErrorsDQM::readHistogram(MonitorElement* aMe, iFeCh < sistrip::FEDCH_PER_FEUNIT; iFeCh++) {//loop on channels unsigned int iChId = sistrip::FEDCH_PER_FEUNIT*iFeId+iFeCh; - const FedChannelConnection & lConnection = cabling_->connection(aFedId,iChId); + const FedChannelConnection & lConnection = cabling_->fedConnection(aFedId,iChId); if (!lConnection.isConnected()) continue; addBadAPV(lConnection,0,lFlag,aCounter); } @@ -321,12 +321,12 @@ void SiStripFEDErrorsDQM::readHistogram(MonitorElement* aMe, if (lIsAPVHist) { unsigned int iAPVid = iChId%2+1; iChId = static_cast(iChId/2.); - const FedChannelConnection & lConnection = cabling_->connection(aFedId,iChId); + const FedChannelConnection & lConnection = cabling_->fedConnection(aFedId,iChId); addBadAPV(lConnection,iAPVid,lFlag,aCounter); }//ifAPVhists else { - const FedChannelConnection & lConnection = cabling_->connection(aFedId,iChId); + const FedChannelConnection & lConnection = cabling_->fedConnection(aFedId,iChId); addBadAPV(lConnection,0,lFlag,aCounter); } }//if not FE hist diff --git a/EventFilter/SiStripRawToDigi/plugins/ExcludedFEDListProducer.cc b/EventFilter/SiStripRawToDigi/plugins/ExcludedFEDListProducer.cc index b7da9816d04e1..42e7541b374bf 100644 --- a/EventFilter/SiStripRawToDigi/plugins/ExcludedFEDListProducer.cc +++ b/EventFilter/SiStripRawToDigi/plugins/ExcludedFEDListProducer.cc @@ -61,8 +61,7 @@ namespace sistrip { event.getByLabel( productLabel_, buffers ); // Retrieve FED ids from cabling map and iterate through - std::vector::const_iterator ifed = cabling_->feds().begin(); - for ( ; ifed != cabling_->feds().end(); ifed++ ) { + for (auto ifed = cabling_->fedIds().begin() ; ifed != cabling_->fedIds().end(); ifed++ ) { // ignore trigger FED // if ( *ifed == triggerFedId_ ) { continue; } @@ -74,11 +73,10 @@ namespace sistrip { if( input.size() == 0 ) { // std::cout << "Input size == 0 for FED number " << static_cast(*ifed) << std::endl; // get the cabling connections for this FED - const std::vector& conns = cabling_->connections(*ifed); + auto conns = cabling_->fedConnections(*ifed); // Mark FED modules as bad detids_.reserve(detids_.size()+conns.size()); - std::vector::const_iterator iconn = conns.begin(); - for ( ; iconn != conns.end(); ++iconn ) { + for (auto iconn = conns.begin() ; iconn != conns.end(); ++iconn ) { if ( !iconn->detId() || iconn->detId() == sistrip::invalid32_ ) continue; detids_.push_back(iconn->detId()); //@@ Possible multiple entries } diff --git a/EventFilter/SiStripRawToDigi/src/SiStripDigiToRaw.cc b/EventFilter/SiStripRawToDigi/src/SiStripDigiToRaw.cc index e04058d5850ed..21f927aa2b25b 100644 --- a/EventFilter/SiStripRawToDigi/src/SiStripDigiToRaw.cc +++ b/EventFilter/SiStripRawToDigi/src/SiStripDigiToRaw.cc @@ -75,17 +75,14 @@ namespace sistrip { //set the L1ID to use in the buffers bufferGenerator_.setL1ID(0xFFFFFF & event.id().event()); - const std::vector& fed_ids = cabling->feds(); - std::vector::const_iterator ifed; - - for ( ifed = fed_ids.begin(); ifed != fed_ids.end(); ifed++ ) { + auto fed_ids = cabling->fedIds(); + for ( auto ifed = fed_ids.begin(); ifed != fed_ids.end(); ++ifed ) { - const std::vector& conns = cabling->connections(*ifed); - std::vector::const_iterator iconn = conns.begin(); + auto conns = cabling->fedConnections(*ifed); FEDStripData fedData(zeroSuppressed); - for ( ; iconn != conns.end(); iconn++ ) { + for (auto iconn = conns.begin() ; iconn != conns.end(); iconn++ ) { // Determine FED key from cabling uint32_t fed_key = ( ( iconn->fedId() & sistrip::invalid_ ) << 16 ) | ( iconn->fedCh() & sistrip::invalid_ ); diff --git a/EventFilter/SiStripRawToDigi/src/SiStripRawToDigiUnpacker.cc b/EventFilter/SiStripRawToDigi/src/SiStripRawToDigiUnpacker.cc index 2415119d5dcca..3bcf40f3ddc68 100644 --- a/EventFilter/SiStripRawToDigi/src/SiStripRawToDigiUnpacker.cc +++ b/EventFilter/SiStripRawToDigi/src/SiStripRawToDigiUnpacker.cc @@ -65,7 +65,7 @@ namespace sistrip { // Check if FEDs found in cabling map and event data if ( edm::isDebugEnabled() ) { - if ( cabling.feds().empty() ) { + if ( cabling.fedIds().empty() ) { edm::LogWarning(sistrip::mlRawToDigi_) << "[sistrip::RawToDigiUnpacker::" << __func__ << "]" << " No FEDs found in cabling map!"; @@ -89,8 +89,8 @@ namespace sistrip { bool first_fed = true; // Retrieve FED ids from cabling map and iterate through - std::vector::const_iterator ifed = cabling.feds().begin(); - for ( ; ifed != cabling.feds().end(); ifed++ ) { + std::vector::const_iterator ifed = cabling.fedIds().begin(); + for ( ; ifed != cabling.fedIds().end(); ifed++ ) { // ignore trigger FED if ( *ifed == triggerFedId_ ) { continue; } @@ -128,7 +128,7 @@ namespace sistrip { } // get the cabling connections for this FED - const std::vector& conns = cabling.connections(*ifed); + auto conns = cabling.fedConnections(*ifed); // Check on FEDRawData pointer if ( !input.data() ) { diff --git a/EventFilter/SiStripRawToDigi/test/plugins/SiStripDigiAnalyzer.cc b/EventFilter/SiStripRawToDigi/test/plugins/SiStripDigiAnalyzer.cc index f58184ceb3c0c..b7d3faa24cbaf 100644 --- a/EventFilter/SiStripRawToDigi/test/plugins/SiStripDigiAnalyzer.cc +++ b/EventFilter/SiStripRawToDigi/test/plugins/SiStripDigiAnalyzer.cc @@ -134,8 +134,8 @@ void SiStripDigiAnalyzer::analyze( const edm::Event& event, const edm::EventSetu pr_r.events_++; sm_r.events_++; zs_r.events_++; - vector::const_iterator ifed = fed_cabling->feds().begin(); - for ( ; ifed != fed_cabling->feds().end(); ifed++ ) { + auto ifed = fed_cabling->fedIds().begin(); + for ( ; ifed != fed_cabling->fedIds().end(); ++ifed ) { anal_.feds_++; vr_r.feds_++; pr_r.feds_++; diff --git a/EventFilter/SiStripRawToDigi/test/plugins/SiStripFEDRawDataAnalyzer.cc b/EventFilter/SiStripRawToDigi/test/plugins/SiStripFEDRawDataAnalyzer.cc index 208e585d3a6a2..c44263f66cac1 100644 --- a/EventFilter/SiStripRawToDigi/test/plugins/SiStripFEDRawDataAnalyzer.cc +++ b/EventFilter/SiStripRawToDigi/test/plugins/SiStripFEDRawDataAnalyzer.cc @@ -68,7 +68,7 @@ void SiStripFEDRawDataAnalyzer::analyze( const edm::Event& event, const edm::Eve event.getByLabel( label_, buffers ); // Local cache of fed ids from cabling - vector fed_ids = cabling->feds(); + auto fed_ids = cabling->fedIds(); // Containers storing fed ids and buffer sizes Feds trg_feds; // trigger feds @@ -193,7 +193,7 @@ void SiStripFEDRawDataAnalyzer::analyze( const edm::Event& event, const edm::Eve uint16_t ifed = trk_feds[ii].first; // record connections - vector channels = cabling->connections(ifed); + auto channels = cabling->fedConnections(ifed); for ( uint16_t chan = 0; chan < channels.size(); ++chan ) { if ( channels[chan].isConnected() ) { connected[ifed].push_back(channels[chan].fedCh()); diff --git a/EventFilter/SiStripRawToDigi/test/plugins/SiStripTrivialDigiSource.cc b/EventFilter/SiStripRawToDigi/test/plugins/SiStripTrivialDigiSource.cc index 715ca6303de18..c58367bf80e15 100644 --- a/EventFilter/SiStripRawToDigi/test/plugins/SiStripTrivialDigiSource.cc +++ b/EventFilter/SiStripRawToDigi/test/plugins/SiStripTrivialDigiSource.cc @@ -68,14 +68,12 @@ void SiStripTrivialDigiSource::produce( edm::Event& event, uint32_t ndigis = 0; // Retrieve fed ids - const std::vector& fed_ids = cabling->feds(); + auto fed_ids = cabling->fedIds(); // Iterate through fed ids and channels - std::vector::const_iterator ifed; - for ( ifed = fed_ids.begin(); ifed != fed_ids.end(); ifed++ ) { - const std::vector& conns = cabling->connections(*ifed); - std::vector::const_iterator iconn = conns.begin(); - for ( ; iconn != conns.end(); iconn++ ) { + for ( auto ifed = fed_ids.begin(); ifed != fed_ids.end(); ifed++ ) { + auto conns = cabling->fedConnections(*ifed); + for (auto iconn = conns.begin() ; iconn != conns.end(); iconn++ ) { // Build FED key uint32_t fed_key = ( ( iconn->fedId() & sistrip::invalid_ ) << 16 ) | ( iconn->fedCh() & sistrip::invalid_ );