10 using namespace sistrip;
26 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
27 <<
" Constructing object...";
34 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
35 <<
" Destructing object...";
42 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]";
46 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
47 <<
" NULL pointer to SiStripConfigDb interface!"
48 <<
" Aborting upload...";
54 for ( ; ip != jp; ++ip ) {
64 update( conns, feds, dcus, detids );
68 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
69 <<
" Uploading FED connections for partition \""
70 << ip->second.partitionName() <<
"\" to DB...";
75 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
76 <<
" Completed database upload of " << conns.size()
77 <<
" ConnectionDescriptions!";
80 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
81 <<
" TEST only! No FED connections will be uploaded to DB...";
88 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
89 <<
" Uploading FED descriptions to DB...";
92 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
93 <<
" Completed database upload of " << feds.size()
94 <<
" Fed9UDescriptions (with connected channels enabled)!";
97 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
98 <<
" TEST only! No FED descriptions will be uploaded to DB...";
116 Analyses::iterator ianal =
data().begin();
117 Analyses::iterator janal =
data().end();
118 for ( ; ianal != janal; ++ianal ) {
123 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
124 <<
" NULL pointer to analysis object!";
133 ConnectionDescription*
conn =
new ConnectionDescription();
134 conn->setFedId( fed_key.fedId() );
135 conn->setFedChannel( fed_key.fedChannel() );
136 conn->setFecHardwareId(
"" );
137 conn->setFecCrateId( fec_key.fecCrate() );
138 conn->setFecSlot( fec_key.fecSlot() );
139 conn->setRingSlot( fec_key.fecRing() );
140 conn->setCcuAddress( fec_key.ccuAddr() );
141 conn->setI2cChannel( fec_key.ccuChan() );
147 SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
148 while ( ifed != feds.end() && !
found ) {
150 uint16_t fed_id =
static_cast<uint16_t
>( (*ifed)->getFedId() );
151 if ( fed_key.fedId() == fed_id ) {
152 conn->setFedCrateId( static_cast<uint16_t>( (*ifed)->getCrateNumber() ) );
153 conn->setFedSlot( static_cast<uint16_t>( (*ifed)->getSlotNumber() ) );
158 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
159 <<
" NULL pointer to Fed9UDescription object!";
166 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
167 <<
" Could not find FED id " << fed_key.fedId()
168 <<
" in vector of FED descriptions!"
169 <<
" Unable to set FED crate and slot for this FED!";
172 conns.push_back(conn);
177 SiStripConfigDb::FedConnectionsV::iterator ifed = conns.begin();
178 for ( ; ifed != conns.end(); ifed++ ) { (*ifed)->display(); }
188 SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
189 SiStripConfigDb::FedDescriptionsV::const_iterator jfed = feds.end();
191 for ( ; ifed != jfed; ++ifed ) {
193 Fed9U::Fed9UAddress addr( ichan );
194 Fed9U::Fed9UAddress addr0( ichan, static_cast<Fed9U::u8>(0) );
195 Fed9U::Fed9UAddress addr1( ichan, static_cast<Fed9U::u8>(1) );
196 (*ifed)->setFedFeUnitDisable( addr,
true );
197 (*ifed)->setApvDisable( addr0,
true );
198 (*ifed)->setApvDisable( addr1,
true );
201 }
catch( ICUtils::ICException&
e ) {
206 uint16_t connected = 0;
207 std::map< uint16_t, std::vector<uint16_t> > enabled;
210 for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
214 SiStripFedKey fed( static_cast<uint16_t>( (*ifed)->getFedId() ),
217 uint32_t fed_key = fed.
key();
220 Analyses::const_iterator iter =
data().find( fed_key );
221 if ( iter ==
data().
end() ) {
continue; }
223 if ( !iter->second->isValid() ) {
continue; }
228 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
229 <<
" NULL pointer to OptoScanAnalysis object!";
235 uint16_t fed_id =
key.fedId();
236 uint16_t fed_ch =
key.fedChannel();
239 Fed9U::Fed9UAddress addr( fed_ch );
240 Fed9U::Fed9UAddress addr0( fed_ch, static_cast<Fed9U::u8>(0) );
241 Fed9U::Fed9UAddress addr1( fed_ch, static_cast<Fed9U::u8>(1) );
242 (*ifed)->setFedFeUnitDisable( addr,
false );
243 (*ifed)->setApvDisable( addr0,
false );
244 (*ifed)->setApvDisable( addr1,
false );
246 enabled[fed_id].push_back(fed_ch);
252 std::stringstream sss;
253 if ( !feds.empty() ) {
254 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
255 <<
" Enabled a total of " << connected
256 <<
" FED channels and disabled " << feds.size() * 96 - connected
257 <<
" FED channels (" << 100 * connected / ( feds.size() * 96 )
261 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
262 <<
" Found no FEDs! (and therefore no connected channels)";
267 std::stringstream ss;
268 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
269 <<
" Dump of enabled FED channels:"
271 std::map< uint16_t, std::vector<uint16_t> >::const_iterator fed = enabled.begin();
272 for ( ; fed != enabled.end(); fed++ ) {
273 ss <<
" Enabled " << fed->second.size()
274 <<
" channels for FED id "
275 << std::setw(3) << fed->first <<
": ";
276 if ( !fed->second.empty() ) {
277 uint16_t
first = fed->second.front();
278 uint16_t
last = fed->second.front();
279 std::vector<uint16_t>::const_iterator chan = fed->second.begin();
280 for ( ; chan != fed->second.end(); chan++ ) {
281 if ( chan != fed->second.begin() ) {
282 if ( *chan != last+1 ) {
283 ss << std::setw(2) << first <<
"->" << std::setw(2) << last <<
", ";
284 if ( chan != fed->second.end() ) { first = *(chan+1); }
289 if ( first != last ) { ss << std::setw(2) << first <<
"->" << std::setw(2) <<
last; }
303 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
304 <<
" NULL pointer to SiStripFedCabling object!";
312 if ( dcus.empty() ) {
314 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
315 <<
" No DCU descriptions found!";
319 if ( detids.empty() ) {
321 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
322 <<
" DCU-DetId map is empty!";
325 Analyses::iterator ianal =
data().begin();
326 Analyses::iterator janal =
data().end();
327 for ( ; ianal != janal; ++ianal ) {
330 if ( !ianal->second->isValid() ) {
continue; }
337 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
338 <<
" NULL pointer to FastFedCablingAnalysis object!";
344 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
345 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
346 while ( !found && idcu != jdcu ) {
347 dcuDescription* dcu =
dynamic_cast<dcuDescription*
>( *idcu );
349 if ( dcu->getDcuType() ==
"FEH" ) {
350 if ( dcu->getDcuHardId() == anal->
dcuHardId() ) {
352 anal->
dcuId( dcu->getDcuHardId() );
361 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
363 if ( idet != detids.end() ) { anal->
detId( idet->second->getDetId() ); }
380 if ( !anal ) {
return; }
387 for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
390 FastFedCablingAnalysisDescription*
tmp;
391 tmp =
new FastFedCablingAnalysisDescription( anal->
highLevel(),
418 typedef std::vector<std::string>
Strings;
420 Strings::const_iterator istr = errors.begin();
421 Strings::const_iterator jstr = errors.end();
422 for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
425 desc.push_back( tmp );
437 std::vector<std::string>
valid;
438 std::vector<std::string> dirty;
439 std::vector<std::string> trimdac;
440 std::vector<std::string>
missing;
441 std::vector<std::string> devices;
442 uint32_t missing_pairs = 0;
445 std::vector<uint32_t> found_dcus;
446 Analyses::iterator ianal =
data().begin();
447 Analyses::iterator janal =
data().end();
448 for ( ; ianal != janal; ++ianal ) {
452 if ( !anal ) {
continue; }
455 std::stringstream ss;
458 ss <<
"DcuId= " << std::hex << std::setw(8) << std::setfill(
'0') << anal->
dcuId() << std::dec <<
" ";
459 ss <<
"DetId= " << std::hex << std::setw(8) << std::setfill(
'0') << anal->
detId() << std::dec;
462 !(anal->
badTrimDac()) ) { valid.push_back( ss.str() ); }
463 if ( anal->
isDirty() ) { dirty.push_back( ss.str() ); }
464 if ( anal->
badTrimDac() ) { trimdac.push_back( ss.str() ); }
467 found_dcus.push_back( anal->
dcuHardId() );
472 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
473 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
474 for ( ; idcu != jdcu; ++idcu ) {
477 dcuDescription* dcu =
dynamic_cast<dcuDescription*
>( *idcu );
478 if ( !dcu ) {
continue; }
479 if ( dcu->getDcuType() !=
"FEH" ) {
continue; }
483 std::vector<uint32_t>::const_iterator iter =
find( found_dcus.begin(), found_dcus.end(), dcu->getDcuHardId() );
484 if ( iter != found_dcus.end() ) {
continue; }
487 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
489 if ( idet == detids.end() ) {
continue; }
490 if ( idet->second ) {
continue; }
493 uint16_t npairs = idet->second->getApvNumber()/2;
497 addrs.resize(6,
false);
499 SiStripConfigDb::DeviceDescriptionsV::const_iterator iapv = apvs.begin();
500 SiStripConfigDb::DeviceDescriptionsV::const_iterator japv = apvs.end();
501 for ( ; iapv != japv; ++iapv ) {
502 apvDescription* apv =
dynamic_cast<apvDescription*
>( *iapv );
503 if ( !apv ) {
continue; }
511 if ( pos < 6 ) { addrs[
pos] =
true; }
517 if ( addrs[0] || addrs[1] ) {
519 std::stringstream ss;
526 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
527 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
528 missing.push_back( ss.str() );
530 if ( addrs[2] || addrs[3] ) {
532 std::stringstream ss;
539 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
540 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
541 missing.push_back( ss.str() );
543 if ( addrs[4] || addrs[5] ) {
545 std::stringstream ss;
552 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
553 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
554 missing.push_back( ss.str() );
557 if ( pairs != npairs ) {
559 missing_pairs = npairs - pairs;
562 std::stringstream ss;
569 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
570 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
571 devices.push_back( ss.str() );
575 std::stringstream ss;
582 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
583 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
584 devices.push_back( ss.str() );
587 if ( !addrs[2] && npairs == 3 ) {
588 std::stringstream ss;
595 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
596 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
597 devices.push_back( ss.str() );
600 if ( !addrs[3] && npairs == 3 ) {
601 std::stringstream ss;
608 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
609 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
610 devices.push_back( ss.str() );
614 std::stringstream ss;
621 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
622 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
623 devices.push_back( ss.str() );
627 std::stringstream ss;
634 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
635 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
636 devices.push_back( ss.str() );
645 std::stringstream ss;
646 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
647 <<
" Summary of connections: " << std::endl
648 <<
" \"Good\" connections : " << valid.size() << std::endl
649 <<
" \"Dirty\" connections : " << dirty.size() << std::endl
650 <<
" \"Bad\" TrimDAQ settings : " << trimdac.size() << std::endl
651 <<
" (\"Missing\" connections : " << missing.size() <<
")" << std::endl
652 <<
" (\"Missing\" APV pairs : " << missing_pairs <<
")" << std::endl
653 <<
" (\"Missing\" APVs : " << devices.size() <<
")" << std::endl;
658 if ( !valid.empty() ) {
659 std::stringstream ss;
660 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
661 <<
" List of \"good\" connections: " << std::endl;
662 std::vector<std::string>::const_iterator istr = valid.begin();
663 std::vector<std::string>::const_iterator jstr = valid.end();
664 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
669 if ( !dirty.empty() ) {
670 std::stringstream ss;
671 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
672 <<
" List of \"dirty\" connections: " << std::endl;
673 std::vector<std::string>::const_iterator istr = dirty.begin();
674 std::vector<std::string>::const_iterator jstr = dirty.end();
675 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
680 if ( !trimdac.empty() ) {
681 std::stringstream ss;
682 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
683 <<
" List of \"bad\" TrimDAC settings: " << std::endl;
684 std::vector<std::string>::const_iterator istr = trimdac.begin();
685 std::vector<std::string>::const_iterator jstr = trimdac.end();
686 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
691 if ( !missing.empty() ) {
692 std::stringstream ss;
693 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
694 <<
" List of \"missing\" connections: " << std::endl;
695 std::vector<std::string>::const_iterator istr = missing.begin();
696 std::vector<std::string>::const_iterator jstr = missing.end();
697 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
702 if ( !devices.empty() ) {
703 std::stringstream ss;
704 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
705 <<
" List of \"missing\" APVs: " << std::endl;
706 std::vector<std::string>::const_iterator istr = devices.begin();
707 std::vector<std::string>::const_iterator jstr = devices.end();
708 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
const uint16_t & lldCh() const
DcuDetIds::range DcuDetIdsRange
const uint32_t & fedKey() const
Analyses::iterator Analysis
void create(SiStripConfigDb::AnalysisDescriptionsV &, Analysis)
const uint32_t & dcuHardId() const
A container class for generic run and event-related info, information required by the commissioning a...
static const uint32_t invalid32_
void uploadFedConnections(std::string partition="")
FedDescriptionsRange getFedDescriptions(std::string partition="")
static const float dirtyThreshold_
FedDescriptions::range FedDescriptionsRange
static const char mlDqmClient_[]
const float & lowLevel() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const uint16_t & i2cAddr() const
const float & highLevel() const
const uint32_t & key() const
FastFedCablingHistosUsingDb(const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const )
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
const_iterator_range partitions() const
static const char mlCabling_[]
Histogram-based analysis for connection loop.
static DcuDetIdsV::const_iterator findDcuDetId(DcuDetIdsV::const_iterator begin, DcuDetIdsV::const_iterator end, uint32_t dcu_id)
const float & min() const
virtual ~FastFedCablingHistosUsingDb()
DeviceDescriptions::range DeviceDescriptionsRange
const uint32_t & dcuId() const
virtual void uploadConfigurations()
An interface class to the DeviceFactory.
bool doUploadConf() const
const float & max() const
const uint32_t & fecKey() const
DeviceAddress deviceAddress(const deviceDescription &)
void clearFedConnections(std::string partition="")
void connections(SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
const uint16_t & feUnit() const
const SiStripDbParams & dbParams() const
void update(SiStripConfigDb::FedConnectionsV &, SiStripConfigDb::FedDescriptionsRange, SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
void uploadFedDescriptions(std::string partition="")
const float & highRms() const
const float & lowRms() const
std::vector< std::vector< double > > tmp
static const uint16_t FEDCH_PER_FED
std::vector< AnalysisDescription * > AnalysisDescriptionsV
const uint16_t & feChan() const
const uint32_t & detId() const
std::vector< FedConnection * > FedConnectionsV
SiStripConfigDb *const db() const
void addFedConnections(std::string partition, FedConnectionsV &)
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
virtual void addDcuDetIds()
DcuDetIdsRange getDcuDetIds(std::string partition="")
SiStripFedCabling *const cabling() const
const VString & getErrorCodes() const
virtual void terse(std::stringstream &ss) const
static const float threshold_