#include <CondFormats/SiStripObjects/interface/SiStripFedCabling.h>
Public Member Functions | |
void | buildFedCabling (const std::vector< FedChannelConnection > &connections) |
Builds FED cabling from vector of FED connections. | |
const FedChannelConnection & | connection (uint16_t fed_id, uint16_t fed_chan) const |
Returns Connection info for a given FED id and channel. | |
const std::vector < FedChannelConnection > & | connections (uint16_t fed_id) const |
Returns all connection info for a given FED id. | |
const std::vector < FedChannelConnection > & | detected () const |
Returns information for "detected, but unconnected" devices. | |
const std::vector< uint16_t > & | feds () const |
Retrieve vector of active FED ids. | |
void | print (std::stringstream &) const |
Prints all connection information for this FED cabling object. | |
SiStripFedCabling () | |
Public default constructor. | |
SiStripFedCabling (const SiStripFedCabling &) | |
Copy constructor. | |
SiStripFedCabling (const std::vector< FedChannelConnection > &) | |
Constructor taking FED channel connection objects as input. | |
void | summary (std::stringstream &) const |
Prints summary information for this FED cabling object. | |
void | terse (std::stringstream &) const |
Prints terse information for this FED cabling object. | |
const std::vector < FedChannelConnection > & | undetected () const |
Returns information for all "undetected" devices. | |
~SiStripFedCabling () | |
Default destructor. | |
Private Attributes | |
std::vector< std::vector < FedChannelConnection > > | connected_ |
Channel-level connection information for FE devices that:
| |
std::vector< FedChannelConnection > | detected_ |
Channel-level connection information for FE devices that:
| |
std::vector< uint16_t > | feds_ |
"Active" FEDs that have connected FE devices. | |
std::vector< FedChannelConnection > | undetected_ |
Channel-level connection information for FE devices that:
|
..
Definition at line 20 of file SiStripFedCabling.h.
SiStripFedCabling::SiStripFedCabling | ( | const std::vector< FedChannelConnection > & | input | ) |
Constructor taking FED channel connection objects as input.
Definition at line 12 of file SiStripFedCabling.cc.
References buildFedCabling(), LogTrace, and sistrip::mlCabling_.
00013 : feds_(), 00014 connected_(), 00015 detected_(), 00016 undetected_() 00017 { 00018 LogTrace(mlCabling_) 00019 << "[SiStripFedCabling::" << __func__ << "]" 00020 << " Constructing object..."; 00021 buildFedCabling( input ); 00022 }
SiStripFedCabling::SiStripFedCabling | ( | const SiStripFedCabling & | input | ) |
Copy constructor.
Definition at line 26 of file SiStripFedCabling.cc.
References buildFedCabling(), connections(), feds(), LogTrace, and sistrip::mlCabling_.
00027 : feds_(), 00028 connected_(), 00029 detected_(), 00030 undetected_() 00031 { 00032 LogTrace(mlCabling_) 00033 << "[SiStripFedCabling::" << __func__ << "]" 00034 << " Constructing object..."; 00035 00036 std::vector<FedChannelConnection> v_fcc; 00037 00038 // Retrieve FED ids from cabling map and iterate through 00039 const std::vector<uint16_t>& fedids = input.feds(); 00040 std::vector<uint16_t>::const_iterator ifed=fedids.begin(); 00041 for ( ; ifed != fedids.end(); ++ifed ) { 00042 //copy the vector of FedChannelConnection for the given ifed 00043 v_fcc.insert(v_fcc.end(),input.connections(*ifed).begin(),input.connections(*ifed).end()); 00044 } 00045 00046 buildFedCabling( v_fcc ); 00047 00048 }
SiStripFedCabling::SiStripFedCabling | ( | ) |
Public default constructor.
Definition at line 52 of file SiStripFedCabling.cc.
References LogTrace, and sistrip::mlCabling_.
00053 : feds_(), 00054 connected_(), 00055 detected_(), 00056 undetected_() 00057 { 00058 LogTrace(mlCabling_) 00059 << "[SiStripFedCabling::" << __func__ << "]" 00060 << " Constructing object..."; 00061 }
SiStripFedCabling::~SiStripFedCabling | ( | ) |
Default destructor.
Definition at line 65 of file SiStripFedCabling.cc.
References LogTrace, and sistrip::mlCabling_.
00065 { 00066 LogTrace(mlCabling_) 00067 << "[SiStripFedCabling::" << __func__ << "]" 00068 << " Destructing object..."; 00069 }
void SiStripFedCabling::buildFedCabling | ( | const std::vector< FedChannelConnection > & | connections | ) |
Builds FED cabling from vector of FED connections.
Definition at line 73 of file SiStripFedCabling.cc.
References sistrip::CMS_FED_ID_MAX, connected_, detected(), detected_, sistrip::FEDCH_PER_FED, feds_, find(), edm::isDebugEnabled(), LogTrace, sistrip::mlCabling_, size, ss, and undetected_.
Referenced by SiStripFedCablingBuilderFromDb::getFedCabling(), and SiStripFedCabling().
00073 { 00074 00075 // Check input 00076 if ( input.empty() ) { 00077 edm::LogError(mlCabling_) 00078 << "[SiStripFedCabling::" << __func__ << "]" 00079 << " Input vector of FedChannelConnections is of zero size!" 00080 << " Unable to populate FED cabling object!"; 00081 return; 00082 } 00083 00084 std::stringstream ss; 00085 ss << "[SiStripFedCabling::" << __func__ << "]" 00086 << " Building FED cabling from " 00087 << input.size() 00088 << " connections..."; 00089 LogTrace(mlCabling_) << ss.str(); 00090 00091 // Clear containers 00092 connected_.clear(); 00093 detected_.clear(); 00094 undetected_.clear(); 00095 00096 // Iterate through FEDs 00097 for ( uint16_t iconn = 0; iconn < input.size(); iconn++ ) { 00098 00099 if ( !input[iconn].isConnected() ) { continue; } 00100 00101 uint16_t fed_id = input[iconn].fedId(); 00102 uint16_t fed_ch = input[iconn].fedCh(); 00103 00104 // Check on FED ids and channels 00105 if ( fed_id > sistrip::CMS_FED_ID_MAX ) { 00106 if ( edm::isDebugEnabled() ) { 00107 edm::LogWarning(mlCabling_) 00108 << "[SiStripFedCabling::" << __func__ << "]" 00109 << " Unexpected FED id! " << fed_id; 00110 } 00111 continue; 00112 } 00113 if ( fed_ch >= sistrip::FEDCH_PER_FED ) { 00114 if ( edm::isDebugEnabled() ) { 00115 edm::LogWarning(mlCabling_) 00116 << "[SiStripFedCabling::" << __func__ << "]" 00117 << " Unexpected FED channel! " << fed_ch; 00118 } 00119 continue; 00120 } 00121 00122 // Resize container to accommodate all FED channels 00123 if ( connected_.size() <= fed_id ) { connected_.resize(fed_id+1); } 00124 if ( connected_[fed_id].size() != 96 ) { connected_[fed_id].resize(96); } 00125 00126 // Fill appropriate container 00127 bool detected = input[iconn].i2cAddr(0) || input[iconn].i2cAddr(1); 00128 bool connected = input[iconn].fedId(); //@@ should check also FeUnit/FeChan are not invalid ??? 00129 if ( detected && connected ) { 00130 connected_[fed_id][fed_ch] = input[iconn]; 00131 } else if ( detected && !connected ) { 00132 detected_.push_back( input[iconn] ); 00133 } else if ( !detected && !connected ) { 00134 undetected_.push_back( input[iconn] ); 00135 } 00136 00137 if ( detected && connected ) { 00138 std::vector<uint16_t>::iterator id = find( feds_.begin(), feds_.end(), fed_id ); 00139 if ( id == feds_.end() ) { feds_.push_back( fed_id ); } 00140 } 00141 00142 } 00143 00144 }
const FedChannelConnection & SiStripFedCabling::connection | ( | uint16_t | fed_id, | |
uint16_t | fed_chan | |||
) | const |
Returns Connection info for a given FED id and channel.
Definition at line 154 of file SiStripFedCabling.cc.
References connected_, empty, edm::isDebugEnabled(), sistrip::mlCabling_, and size.
Referenced by CommissioningHistosUsingDb::addDcuDetIds(), SiStripFEDMonitorPlugin::analyzeChannels(), SiStripPedDB::beginJob(), SiStripNoiseDB::beginJob(), SiStripFEDCheckPlugin::hasNonFatalError(), NoiseHistosUsingDb::update(), PedsOnlyHistosUsingDb::update(), PedestalsHistosUsingDb::update(), and ApvTimingHistosUsingDb::update().
00155 { 00156 00157 //@@ should use connections(fed_id) method here!!! 00158 00159 if ( !connected_.empty() ) { 00160 if ( fed_id < connected_.size() ) { 00161 if ( !connected_[fed_id].empty() ) { 00162 if ( fed_chan < connected_[fed_id].size() ) { 00163 return connected_[fed_id][fed_chan]; 00164 } else { 00165 if ( edm::isDebugEnabled() ) { 00166 edm::LogWarning(mlCabling_) 00167 << "[SiStripFedCabling::" << __func__ << "]" 00168 << " FED channel (" << fed_chan 00169 << ") is greater than or equal to vector size (" 00170 << connected_[fed_chan].size() << ")!"; 00171 } 00172 } 00173 } else { 00174 if ( edm::isDebugEnabled() ) { 00175 edm::LogWarning(mlCabling_) 00176 << "[SiStripFedCabling::" << __func__ << "]" 00177 << " Cabling map is empty for FED id " 00178 << fed_id; 00179 } 00180 } 00181 } else { 00182 if ( edm::isDebugEnabled() ) { 00183 edm::LogWarning(mlCabling_) 00184 << "[SiStripFedCabling::" << __func__ << "]" 00185 << " FED id (" << fed_id 00186 << ") is greater than or equal to vector size (" 00187 << connected_.size() << ")!"; 00188 } 00189 } 00190 } else { 00191 edm::LogError(mlCabling_) 00192 << "[SiStripFedCabling::" << __func__ << "]" 00193 << " Cabling map is empty!"; 00194 } 00195 00196 static FedChannelConnection conn; 00197 return conn; 00198 00199 }
const std::vector< FedChannelConnection > & SiStripFedCabling::connections | ( | uint16_t | fed_id | ) | const |
Returns all connection info for a given FED id.
Definition at line 203 of file SiStripFedCabling.cc.
References connected_, empty, edm::isDebugEnabled(), and sistrip::mlCabling_.
Referenced by CnBAnalyzer::analyze(), SiStripFecCabling::buildFecCabling(), ViewTranslator::buildMaps(), FineDelayHistosUsingDb::computeDelays(), SiStripRawToDigiUnpacker::createDigis(), SiStripCommissioningSource::createTasks(), SiStripCommissioningSource::endJob(), SiStripCommissioningSource::fillHistos(), print(), SiStripDetCabling::SiStripDetCabling(), SiStripFedCabling(), summary(), terse(), LatencyHistosUsingDb::update(), and FineDelayHistosUsingDb::update().
00203 { 00204 00205 if ( !connected_.empty() ) { 00206 if ( fed_id < connected_.size() ) { 00207 if ( !connected_[fed_id].empty() ) { 00208 return connected_[fed_id]; 00209 } else { 00210 if ( edm::isDebugEnabled() ) { 00211 edm::LogWarning(mlCabling_) 00212 << "[SiStripFedCabling::" << __func__ << "]" 00213 << " Cabling map is empty for FED id " 00214 << fed_id; 00215 } 00216 } 00217 } else { 00218 if ( edm::isDebugEnabled() ) { 00219 edm::LogWarning(mlCabling_) 00220 << "[SiStripFedCabling::" << __func__ << "]" 00221 << " FED id (" << fed_id 00222 << ") is greater than or equal to vector size (" 00223 << connected_.size() << ")!"; 00224 } 00225 } 00226 } else { 00227 edm::LogError(mlCabling_) 00228 << "[SiStripFedCabling::" << __func__ << "]" 00229 << " Cabling map is empty!"; 00230 } 00231 00232 static FedChannelConnection conn; 00233 static std::vector<FedChannelConnection> connections(96,conn); 00234 return connections; 00235 00236 }
const std::vector< FedChannelConnection > & SiStripFedCabling::detected | ( | ) | const [inline] |
Returns information for "detected, but unconnected" devices.
Definition at line 109 of file SiStripFedCabling.h.
References detected_.
Referenced by buildFedCabling(), and SiStripDetCabling::SiStripDetCabling().
00109 { return detected_; }
const std::vector< uint16_t > & SiStripFedCabling::feds | ( | ) | const |
Retrieve vector of active FED ids.
Definition at line 148 of file SiStripFedCabling.cc.
References feds_.
Referenced by SiStripPedDB::beginJob(), SiStripNoiseDB::beginJob(), SiStripFecCabling::buildFecCabling(), ViewTranslator::buildMaps(), FineDelayHistosUsingDb::computeDelays(), SiStripRawToDigiUnpacker::createDigis(), SiStripCommissioningSource::createTasks(), SiStripCommissioningSource::endJob(), SiStripCommissioningSource::fillCablingHistos(), SiStripCommissioningSource::fillHistos(), print(), SiStripDetCabling::SiStripDetCabling(), SiStripFedCabling(), summary(), terse(), LatencyHistosUsingDb::update(), ApvTimingHistosUsingDb::update(), and FineDelayHistosUsingDb::update().
00148 { 00149 return feds_; 00150 }
void SiStripFedCabling::print | ( | std::stringstream & | ss | ) | const |
Prints all connection information for this FED cabling object.
Definition at line 240 of file SiStripFedCabling.cc.
References connections(), detected_, empty, lat::endl(), feds(), sistrip::invalid_, and undetected_.
Referenced by operator<<().
00240 { 00241 00242 const std::vector<uint16_t>& fed_ids = feds(); 00243 if ( feds().empty() ) { 00244 ss << "[SiStripFedCabling::" << __func__ << "]" 00245 << " No FEDs found! Unable to print cabling map!"; 00246 return; 00247 } else { 00248 ss << "[SiStripFedCabling::" << __func__ << "]" 00249 << " Printing cabling map for " << fed_ids.size() 00250 << " FEDs with following ids: "; 00251 } 00252 00253 std::vector<uint16_t>::const_iterator ii = fed_ids.begin(); 00254 for ( ; ii != fed_ids.end(); ii++ ) { ss << *ii << " "; } 00255 ss << std::endl << std::endl; 00256 00257 uint16_t total = 0; 00258 uint16_t nfeds = 0; 00259 uint16_t cntr = 0; 00260 00261 std::vector<uint16_t>::const_iterator ifed = fed_ids.begin(); 00262 for ( ; ifed != fed_ids.end(); ifed++ ) { 00263 const std::vector<FedChannelConnection>& conns = connections(*ifed); 00264 00265 ss << " Printing cabling information for FED id " << *ifed 00266 << " (found " << conns.size() 00267 << " FedChannelConnection objects...)" 00268 << std::endl; 00269 00270 uint16_t ichan = 0; 00271 uint16_t connected = 0; 00272 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin(); 00273 for ( ; iconn != conns.end(); iconn++ ) { 00274 if ( iconn->fedId() != sistrip::invalid_ ) { 00275 connected++; 00276 ss << *iconn << std::endl; 00277 } else { 00278 ss << " (FedId/Ch " << *ifed << "/" << ichan 00279 << ": unconnected channel...)" << std::endl; 00280 cntr++; 00281 } 00282 ichan++; 00283 } 00284 00285 ss << " Found " << connected 00286 << " connected channels for FED id " << *ifed << std::endl 00287 << std::endl; 00288 if ( connected ) { nfeds++; total += connected; } 00289 00290 } // fed loop 00291 00292 float percent = (100.*cntr) / (96.*nfeds); 00293 percent = static_cast<uint16_t>( 10.*percent ); 00294 percent /= 10.; 00295 ss << " Found " << total 00296 << " APV pairs that are connected to a total of " 00297 << nfeds << " FEDs" << std::endl 00298 << " " << detected_.size() 00299 << " APV pairs have been detected, but are not connected" << std::endl 00300 << " " << undetected_.size() 00301 << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl 00302 << " " << cntr 00303 << " FED channels out of a possible " << (96*nfeds) 00304 << " (" << nfeds << " FEDs) are unconnected (" 00305 << percent << "%)" << std::endl 00306 << std::endl; 00307 00308 }
void SiStripFedCabling::summary | ( | std::stringstream & | ss | ) | const |
Prints summary information for this FED cabling object.
Definition at line 350 of file SiStripFedCabling.cc.
References connections(), detected_, empty, lat::endl(), feds(), SiStripFedKey::feUnit(), sistrip::mlCabling_, undetected_, and sistrip::valid_.
Referenced by CommissioningHistosUsingDb::CommissioningHistosUsingDb(), and SiStripRawToDigiModule::updateCabling().
00350 { 00351 00352 ss << "[SiStripFedCabling::" << __func__ << "]"; 00353 00354 const std::vector<uint16_t>& fed_ids = feds(); 00355 if ( feds().empty() ) { 00356 ss << " No FEDs found!"; 00357 return; 00358 } 00359 00360 ss << " Found " << feds().size() << " FEDs" 00361 << " with number of connected channels per front-end unit: " 00362 << std::endl 00363 << " FedId FeUnit1 FeUnit2 FeUnit3 FeUnit4 FeUnit5 FeUnit6 FeUnit7 FeUnit8 Total" 00364 << std::endl; 00365 00366 uint16_t total = 0; 00367 uint16_t nfeds = 0; 00368 00369 // iterate through fed ids 00370 std::vector<uint16_t>::const_iterator ii = fed_ids.begin(); 00371 std::vector<uint16_t>::const_iterator jj = fed_ids.end(); 00372 for ( ; ii != jj; ++ii ) { 00373 00374 // check number of connection objects 00375 const std::vector<FedChannelConnection>& conns = connections(*ii); 00376 if ( conns.size() < 96 ) { 00377 edm::LogError(mlCabling_) 00378 << "[SiStripFedCabling::" << __func__ << "]" 00379 << " Unexpected size for FedChannelConnection vector! " 00380 << conns.size(); 00381 return; 00382 } 00383 00384 // count connected channels at level of fe unit 00385 std::vector<uint16_t> connected; 00386 connected.resize(8,0); 00387 for ( uint16_t ichan = 0; ichan < 96; ++ichan ) { 00388 if ( conns[ichan].fedId() < sistrip::valid_ ) { 00389 uint16_t unit = SiStripFedKey::feUnit(ichan); 00390 if ( unit > 8 ) { continue; } 00391 connected[unit-1]++; 00392 } 00393 } 00394 00395 // increment counters 00396 uint16_t tot = 0 ; 00397 ss << " " << std::setw(5) << *ii; 00398 if ( !connected.empty() ) { nfeds++; } 00399 for ( uint16_t unit = 0; unit < 8; ++unit ) { 00400 ss << " " << std::setw(7) << connected[unit]; 00401 if ( !connected.empty() ) { tot += connected[unit]; } 00402 } 00403 ss << " " << std::setw(5) << tot << std::endl; 00404 total += tot; 00405 00406 } 00407 00408 // print out 00409 float percent = (100.*total) / (96.*nfeds); 00410 percent = static_cast<uint16_t>( 10.*percent ); 00411 percent /= 10.; 00412 ss << " Found: " << std::endl 00413 << " " << nfeds << " out of " << feds().size() << " FEDs with at least one connected channel " << std::endl 00414 << " " << feds().size() - nfeds << " out of " << feds().size() << " FEDs with no connected channels." << std::endl 00415 << " " << total << " connected channels in total" << std::endl 00416 << " " << detected_.size() << " APV pairs have been detected, but are not connected" << std::endl 00417 << " " << undetected_.size() << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl 00418 << " " << percent << "% of FED channels are connected" << std::endl; 00419 00420 }
void SiStripFedCabling::terse | ( | std::stringstream & | ss | ) | const |
Prints terse information for this FED cabling object.
Definition at line 312 of file SiStripFedCabling.cc.
References connections(), empty, lat::endl(), feds(), and sistrip::valid_.
Referenced by CommissioningHistosUsingDb::CommissioningHistosUsingDb(), and SiStripRawToDigiModule::updateCabling().
00312 { 00313 00314 ss << "[SiStripFedCabling::" << __func__ << "]"; 00315 00316 const std::vector<uint16_t>& fed_ids = feds(); 00317 if ( feds().empty() ) { 00318 ss << " No FEDs found! Unable to print cabling map!"; 00319 return; 00320 } 00321 00322 ss << " Printing cabling map for " << fed_ids.size() 00323 << " FEDs: " << std::endl << std::endl; 00324 00325 std::vector<uint16_t>::const_iterator ifed = fed_ids.begin(); 00326 for ( ; ifed != fed_ids.end(); ifed++ ) { 00327 00328 const std::vector<FedChannelConnection>& conns = connections(*ifed); 00329 00330 uint16_t connected = 0; 00331 std::vector<FedChannelConnection>::const_iterator iconn = conns.begin(); 00332 for ( ; iconn != conns.end(); iconn++ ) { 00333 if ( iconn->fedId() < sistrip::valid_ ) { 00334 connected++; 00335 iconn->terse(ss); 00336 ss << std::endl; 00337 } 00338 } 00339 00340 ss << " Found " << connected 00341 << " connected channels for FED id " << *ifed << std::endl 00342 << std::endl; 00343 00344 } 00345 00346 }
const std::vector< FedChannelConnection > & SiStripFedCabling::undetected | ( | ) | const [inline] |
Returns information for all "undetected" devices.
Definition at line 110 of file SiStripFedCabling.h.
References undetected_.
Referenced by SiStripDetCabling::SiStripDetCabling().
00110 { return undetected_; }
std::vector< std::vector<FedChannelConnection> > SiStripFedCabling::connected_ [private] |
Channel-level connection information for FE devices that:
Info is arranged according to FED id and channel. (1st index is FED id, 2nd index is FED channel.)
Definition at line 85 of file SiStripFedCabling.h.
Referenced by buildFedCabling(), connection(), and connections().
std::vector<FedChannelConnection> SiStripFedCabling::detected_ [private] |
Channel-level connection information for FE devices that:
Definition at line 93 of file SiStripFedCabling.h.
Referenced by buildFedCabling(), detected(), print(), and summary().
std::vector<uint16_t> SiStripFedCabling::feds_ [private] |
"Active" FEDs that have connected FE devices.
Definition at line 75 of file SiStripFedCabling.h.
Referenced by buildFedCabling(), and feds().
std::vector<FedChannelConnection> SiStripFedCabling::undetected_ [private] |
Channel-level connection information for FE devices that:
The DetId for these devices are inferred from the static LUT in the configuration database.
Definition at line 103 of file SiStripFedCabling.h.
Referenced by buildFedCabling(), print(), summary(), and undetected().