CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

SiStripFedCabling Class Reference

Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses, DCU id... More...

#include <SiStripFedCabling.h>

List of all members.

Classes

class  ConnsRange
 Builds range of iterators from pair of offsets. More...

Public Types

typedef std::vector
< FedChannelConnection
Conns
typedef Conns::const_iterator ConnsConstIter
typedef boost::iterator_range
< ConnsConstIter
ConnsConstIterRange
typedef Conns::iterator ConnsIter
typedef boost::iterator_range
< ConnsIter
ConnsIterRange
typedef std::pair< uint32_t,
uint32_t > 
ConnsPair
typedef std::vector< uint16_t > Feds
typedef Feds::const_iterator FedsConstIter
typedef boost::iterator_range
< FedsConstIter
FedsConstIterRange
typedef Feds::iterator FedsIter
typedef boost::iterator_range
< FedsIter
FedsIterRange
typedef std::vector< ConnsPairRegistry

Public Member Functions

void buildFedCabling (const std::vector< FedChannelConnection > &)
void buildFedCabling (ConnsConstIterRange connections)
const FedChannelConnectionconnection (uint16_t fed_id, uint16_t fed_ch) const
const std::vector
< FedChannelConnection > & 
connections (uint16_t fed_id) const
const std::vector
< FedChannelConnection > & 
detected () const
ConnsConstIterRange detectedDevices () const
FedChannelConnection fedConnection (uint16_t fed_id, uint16_t fed_ch) const
ConnsConstIterRange fedConnections (uint16_t fed_id) const
FedsConstIterRange fedIds () const
const std::vector< uint16_t > & feds () const
void print (std::stringstream &ss) const
 LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTDEBUG.
void printDebug (std::stringstream &) const
void printSummary (std::stringstream &) const
ConnsRange range (ConnsPair) const
 Builds range of iterators from pair of offsets.
 SiStripFedCabling (const std::vector< FedChannelConnection > &)
 SiStripFedCabling ()
 SiStripFedCabling (ConnsConstIterRange)
 SiStripFedCabling (const SiStripFedCabling &)
void summary (std::stringstream &ss) const
 LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
void terse (std::stringstream &) const
const std::vector
< FedChannelConnection > & 
undetected () const
ConnsConstIterRange undetectedDevices () const
 ~SiStripFedCabling ()

Private Attributes

Conns connections_
 Container of connection objects.
Conns detected_
 Connections to FE devices that are not detected.
Feds feds_
 "Active" FEDs that have connected FE devices
Registry registry_
 Container of "ranges" indexed by FED id.
Conns undetected_
 FE devices that are detected.

Detailed Description

Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses, DCU id...

Definition at line 332 of file SiStripFedCabling.h.


Member Typedef Documentation

Definition at line 348 of file SiStripFedCabling.h.

typedef Conns::const_iterator SiStripFedCabling::ConnsConstIter

Definition at line 352 of file SiStripFedCabling.h.

Definition at line 356 of file SiStripFedCabling.h.

typedef Conns::iterator SiStripFedCabling::ConnsIter

Definition at line 350 of file SiStripFedCabling.h.

typedef boost::iterator_range<ConnsIter> SiStripFedCabling::ConnsIterRange

Definition at line 354 of file SiStripFedCabling.h.

typedef std::pair<uint32_t,uint32_t> SiStripFedCabling::ConnsPair

Definition at line 358 of file SiStripFedCabling.h.

typedef std::vector<uint16_t> SiStripFedCabling::Feds

Definition at line 338 of file SiStripFedCabling.h.

typedef Feds::const_iterator SiStripFedCabling::FedsConstIter

Definition at line 342 of file SiStripFedCabling.h.

typedef boost::iterator_range<FedsConstIter> SiStripFedCabling::FedsConstIterRange

Definition at line 346 of file SiStripFedCabling.h.

typedef Feds::iterator SiStripFedCabling::FedsIter

Definition at line 340 of file SiStripFedCabling.h.

typedef boost::iterator_range<FedsIter> SiStripFedCabling::FedsIterRange

Definition at line 344 of file SiStripFedCabling.h.

typedef std::vector<ConnsPair> SiStripFedCabling::Registry

Definition at line 360 of file SiStripFedCabling.h.


Constructor & Destructor Documentation

SiStripFedCabling::SiStripFedCabling ( const std::vector< FedChannelConnection > &  input)

TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!

Definition at line 18 of file SiStripFedCabling.cc.

References buildFedCabling(), LogTrace, and sistrip::mlCabling_.

  : feds_(),
    connected_(),
    detected_(),
    undetected_()
{
  LogTrace(mlCabling_)
    << "[SiStripFedCabling::" << __func__ << "]"
    << " Constructing object...";
  buildFedCabling( input );
}
SiStripFedCabling::SiStripFedCabling ( ConnsConstIterRange  )

Constructor taking FED channel connection objects as input.

SiStripFedCabling::SiStripFedCabling ( const SiStripFedCabling input)

Copy constructor.

Definition at line 32 of file SiStripFedCabling.cc.

References buildFedCabling(), connections(), feds(), LogTrace, and sistrip::mlCabling_.

  : feds_(),
    connected_(),
    detected_(),
    undetected_()
{
  LogTrace(mlCabling_)
    << "[SiStripFedCabling::" << __func__ << "]"
    << " Constructing object...";

  std::vector<FedChannelConnection> v_fcc;

  // Retrieve FED ids from cabling map and iterate through                                                                                                                                                    
  const std::vector<uint16_t>& fedids = input.feds();
  std::vector<uint16_t>::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 ( )

Public default constructor.

Definition at line 58 of file SiStripFedCabling.cc.

References LogTrace, and sistrip::mlCabling_.

  : feds_(),
    connected_(),
    detected_(),
    undetected_()
{
  LogTrace(mlCabling_) 
    << "[SiStripFedCabling::" << __func__ << "]"
    << " Constructing object...";
}
SiStripFedCabling::~SiStripFedCabling ( )

Default destructor.

Definition at line 71 of file SiStripFedCabling.cc.

References LogTrace, and sistrip::mlCabling_.

                                      {
  LogTrace(mlCabling_)
    << "[SiStripFedCabling::" << __func__ << "]"
    << " Destructing object...";
}

Member Function Documentation

void SiStripFedCabling::buildFedCabling ( const std::vector< FedChannelConnection > &  input)

TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!

Definition at line 79 of file SiStripFedCabling.cc.

References sistrip::CMS_FED_ID_MAX, detected(), detected_, sistrip::FEDCH_PER_FED, feds_, spr::find(), edm::isDebugEnabled(), LogTrace, sistrip::mlCabling_, findQualityFiles::size, and undetected_.

Referenced by SiStripFedCablingBuilderFromDb::getFedCabling(), and SiStripFedCabling().

                                                                                      {
  
  // 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<uint16_t>::iterator id = find( feds_.begin(), feds_.end(), fed_id );
      if ( id == feds_.end() ) { feds_.push_back( fed_id ); }
    }
    
  }
  
}
void SiStripFedCabling::buildFedCabling ( ConnsConstIterRange  connections)

Builds FED cabling from vector of FED connections.

const FedChannelConnection & SiStripFedCabling::connection ( uint16_t  fed_id,
uint16_t  fed_ch 
) const

TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!

Definition at line 160 of file SiStripFedCabling.cc.

References results_mgr::conn, relativeConstraints::empty, edm::isDebugEnabled(), sistrip::mlCabling_, and findQualityFiles::size.

Referenced by CommissioningHistosUsingDb::addDcuDetIds(), SiStripCMMonitorPlugin::analyze(), SiStripSpyMonitorModule::analyze(), SiStripShotFilter::filter(), sistrip::FEDEmulatorModule::produce(), SiStripFEDErrorsDQM::readHistogram(), NoiseHistosUsingDb::update(), PedsFullNoiseHistosUsingDb::update(), PedestalsHistosUsingDb::update(), PedsOnlyHistosUsingDb::update(), and ApvTimingHistosUsingDb::update().

                                                                                     {

  //@@ 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;
  
}
const std::vector< FedChannelConnection > & SiStripFedCabling::connections ( uint16_t  fed_id) const

TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!

Definition at line 209 of file SiStripFedCabling.cc.

References results_mgr::conn, relativeConstraints::empty, edm::isDebugEnabled(), and sistrip::mlCabling_.

Referenced by SiStripFecCabling::buildFecCabling(), ViewTranslator::buildMaps(), FineDelayHistosUsingDb::computeDelays(), sistrip::RawToDigiUnpacker::createDigis(), sistrip::SpyUnpacker::createDigis(), SiStripCommissioningSource::createTasks(), SiStripCommissioningSource::endJob(), SiStripCommissioningSource::fillHistos(), LaserAlignmentEventFilter::filter(), SiStripFedCablingManipulator::manipulate(), sistrip::SpyDigiConverter::mergeModuleChannels(), sistrip::ExcludedFEDListProducer::produce(), SiStripFEDErrorsDQM::readBadAPVs(), SiStripFedCabling(), terse(), TrackerMap::TrackerMap(), SiStripQuality::turnOffFeds(), LatencyHistosUsingDb::update(), and FineDelayHistosUsingDb::update().

                                                                                             {
  
  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<FedChannelConnection> connections(96,conn); 
  return connections;
  
}
const std::vector<FedChannelConnection>& SiStripFedCabling::detected ( ) const

TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!

Referenced by buildFedCabling().

SiStripFedCabling::ConnsConstIterRange SiStripFedCabling::detectedDevices ( ) const [inline]

Returns information for "detected, but unconnected" devices.

Definition at line 498 of file SiStripFedCabling.h.

References detected_.

Referenced by SiStripDetCabling::SiStripDetCabling().

                                                                                     { 
  return ConnsConstIterRange( detected_.begin(), detected_.end() ); 
}
FedChannelConnection SiStripFedCabling::fedConnection ( uint16_t  fed_id,
uint16_t  fed_ch 
) const

Returns connection object for a given FED id and channel.

ConnsConstIterRange SiStripFedCabling::fedConnections ( uint16_t  fed_id) const

Returns all connection objects for a given FED id.

Referenced by SiStripDetCabling::SiStripDetCabling().

SiStripFedCabling::FedsConstIterRange SiStripFedCabling::fedIds ( ) const [inline]

Retrieve vector of active FED ids.

Definition at line 494 of file SiStripFedCabling.h.

References feds_.

                                                                           {
  return FedsConstIterRange( feds_.begin(), feds_.end() );
}
const std::vector< uint16_t > & SiStripFedCabling::feds ( ) const
void SiStripFedCabling::print ( std::stringstream &  ss) const [inline]

LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTDEBUG.

Definition at line 425 of file SiStripFedCabling.h.

References printDebug().

Referenced by operator<<().

                                          {
    printDebug(ss);
  }
void SiStripFedCabling::printDebug ( std::stringstream &  ) const

Prints all connection information for this FED cabling object.

Referenced by print().

void SiStripFedCabling::printSummary ( std::stringstream &  ) const

Prints summary information for this FED cabling object.

Referenced by summary().

SiStripFedCabling::ConnsRange SiStripFedCabling::range ( SiStripFedCabling::ConnsPair  p) const [inline]

Builds range of iterators from pair of offsets.

Definition at line 542 of file SiStripFedCabling.h.

References connections_.

                                                                                                {
  return ConnsRange( connections_, p );
}
void SiStripFedCabling::summary ( std::stringstream &  ss) const [inline]

LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.

Definition at line 435 of file SiStripFedCabling.h.

References printSummary().

Referenced by CommissioningHistosUsingDb::CommissioningHistosUsingDb(), and sistrip::RawToDigiModule::updateCabling().

                                            {
    printSummary(ss);
  }
void SiStripFedCabling::terse ( std::stringstream &  ss) const

Prints terse information for this FED cabling object.

Definition at line 318 of file SiStripFedCabling.cc.

References connections(), relativeConstraints::empty, feds(), and sistrip::valid_.

Referenced by CommissioningHistosUsingDb::CommissioningHistosUsingDb(), and sistrip::RawToDigiModule::updateCabling().

                                                         {
  
  ss << "[SiStripFedCabling::" << __func__ << "]";
    
  const std::vector<uint16_t>& 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<uint16_t>::const_iterator ifed = fed_ids.begin(); 
  for ( ; ifed != fed_ids.end(); ifed++ ) {

    const std::vector<FedChannelConnection>& conns = connections(*ifed);
    
    ss << " Printing cabling information for FED id " << *ifed 
       << " (found " << conns.size() 
       << " FedChannelConnection objects...)"
       << std::endl;
    
    uint16_t connected = 0;
    std::vector<FedChannelConnection>::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;
    
  }
  
}
const std::vector<FedChannelConnection>& SiStripFedCabling::undetected ( ) const

TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!

SiStripFedCabling::ConnsConstIterRange SiStripFedCabling::undetectedDevices ( ) const [inline]

Returns information for all "undetected" devices.

Definition at line 502 of file SiStripFedCabling.h.

References undetected_.

Referenced by SiStripDetCabling::SiStripDetCabling().

                                                                                      { 
  return ConnsConstIterRange( undetected_.begin(), undetected_.end() ); 
}

Member Data Documentation

Container of connection objects.

Definition at line 482 of file SiStripFedCabling.h.

Referenced by range().

Connections to FE devices that are not detected.

Definition at line 485 of file SiStripFedCabling.h.

Referenced by buildFedCabling(), and detectedDevices().

"Active" FEDs that have connected FE devices

Definition at line 476 of file SiStripFedCabling.h.

Referenced by buildFedCabling(), fedIds(), and feds().

Container of "ranges" indexed by FED id.

Definition at line 479 of file SiStripFedCabling.h.

FE devices that are detected.

Definition at line 488 of file SiStripFedCabling.h.

Referenced by buildFedCabling(), and undetectedDevices().