9 using namespace sistrip;
25 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
26 <<
" Constructing object...";
33 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
34 <<
" Destructing object...";
41 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]";
45 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
46 <<
" NULL pointer to SiStripConfigDb interface!"
47 <<
" Aborting upload...";
53 for ( ; ip != jp; ++ip ) {
63 update( conns, feds, dcus, detids );
67 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
68 <<
" Uploading FED connections for partition \""
69 << ip->second.partitionName() <<
"\" to DB...";
74 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
75 <<
" Completed database upload of " << conns.size()
76 <<
" ConnectionDescriptions!";
79 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
80 <<
" TEST only! No FED connections will be uploaded to DB...";
87 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
88 <<
" Uploading FED descriptions to DB...";
91 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
92 <<
" Completed database upload of " << feds.size()
93 <<
" Fed9UDescriptions (with connected channels enabled)!";
96 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
97 <<
" TEST only! No FED descriptions will be uploaded to DB...";
115 Analyses::iterator ianal =
data().begin();
116 Analyses::iterator janal =
data().end();
117 for ( ; ianal != janal; ++ianal ) {
122 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
123 <<
" NULL pointer to analysis object!";
132 ConnectionDescription*
conn =
new ConnectionDescription();
133 conn->setFedId( fed_key.fedId() );
134 conn->setFedChannel( fed_key.fedChannel() );
135 conn->setFecHardwareId(
"" );
136 conn->setFecCrateId( fec_key.fecCrate() );
137 conn->setFecSlot( fec_key.fecSlot() );
138 conn->setRingSlot( fec_key.fecRing() );
139 conn->setCcuAddress( fec_key.ccuAddr() );
140 conn->setI2cChannel( fec_key.ccuChan() );
146 SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
147 while ( ifed != feds.end() && !
found ) {
149 uint16_t fed_id =
static_cast<uint16_t
>( (*ifed)->getFedId() );
150 if ( fed_key.fedId() == fed_id ) {
151 conn->setFedCrateId( static_cast<uint16_t>( (*ifed)->getCrateNumber() ) );
152 conn->setFedSlot( static_cast<uint16_t>( (*ifed)->getSlotNumber() ) );
157 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
158 <<
" NULL pointer to Fed9UDescription object!";
165 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
166 <<
" Could not find FED id " << fed_key.fedId()
167 <<
" in vector of FED descriptions!"
168 <<
" Unable to set FED crate and slot for this FED!";
171 conns.push_back(conn);
176 SiStripConfigDb::FedConnectionsV::iterator ifed = conns.begin();
177 for ( ; ifed != conns.end(); ifed++ ) { (*ifed)->display(); }
187 SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
188 SiStripConfigDb::FedDescriptionsV::const_iterator jfed = feds.end();
190 for ( ; ifed != jfed; ++ifed ) {
192 Fed9U::Fed9UAddress addr( ichan );
193 Fed9U::Fed9UAddress addr0( ichan, static_cast<Fed9U::u8>(0) );
194 Fed9U::Fed9UAddress addr1( ichan, static_cast<Fed9U::u8>(1) );
195 (*ifed)->setFedFeUnitDisable( addr,
true );
196 (*ifed)->setApvDisable( addr0,
true );
197 (*ifed)->setApvDisable( addr1,
true );
200 }
catch( ICUtils::ICException&
e ) {
205 uint16_t connected = 0;
206 std::map< uint16_t, std::vector<uint16_t> > enabled;
209 for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
213 SiStripFedKey fed( static_cast<uint16_t>( (*ifed)->getFedId() ),
216 uint32_t fed_key = fed.
key();
219 Analyses::const_iterator
iter =
data().find( fed_key );
220 if ( iter ==
data().
end() ) {
continue; }
222 if ( !iter->second->isValid() ) {
continue; }
227 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
228 <<
" NULL pointer to OptoScanAnalysis object!";
234 uint16_t fed_id =
key.fedId();
235 uint16_t fed_ch =
key.fedChannel();
238 Fed9U::Fed9UAddress addr( fed_ch );
239 Fed9U::Fed9UAddress addr0( fed_ch, static_cast<Fed9U::u8>(0) );
240 Fed9U::Fed9UAddress addr1( fed_ch, static_cast<Fed9U::u8>(1) );
241 (*ifed)->setFedFeUnitDisable( addr,
false );
242 (*ifed)->setApvDisable( addr0,
false );
243 (*ifed)->setApvDisable( addr1,
false );
245 enabled[fed_id].push_back(fed_ch);
251 std::stringstream sss;
252 if ( !feds.empty() ) {
253 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
254 <<
" Enabled a total of " << connected
255 <<
" FED channels and disabled " << feds.size() * 96 - connected
256 <<
" FED channels (" << 100 * connected / ( feds.size() * 96 )
260 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
261 <<
" Found no FEDs! (and therefore no connected channels)";
266 std::stringstream
ss;
267 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
268 <<
" Dump of enabled FED channels:"
270 std::map< uint16_t, std::vector<uint16_t> >::const_iterator fed = enabled.begin();
271 for ( ; fed != enabled.end(); fed++ ) {
272 ss <<
" Enabled " << fed->second.size()
273 <<
" channels for FED id "
274 << std::setw(3) << fed->first <<
": ";
275 if ( !fed->second.empty() ) {
276 uint16_t
first = fed->second.front();
277 uint16_t
last = fed->second.front();
278 std::vector<uint16_t>::const_iterator chan = fed->second.begin();
279 for ( ; chan != fed->second.end(); chan++ ) {
280 if ( chan != fed->second.begin() ) {
281 if ( *chan != last+1 ) {
282 ss << std::setw(2) << first <<
"->" << std::setw(2) << last <<
", ";
283 if ( chan != fed->second.end() ) { first = *(chan+1); }
288 if ( first != last ) { ss << std::setw(2) << first <<
"->" << std::setw(2) <<
last; }
302 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
303 <<
" NULL pointer to SiStripFedCabling object!";
311 if ( dcus.empty() ) {
313 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
314 <<
" No DCU descriptions found!";
318 if ( detids.empty() ) {
320 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
321 <<
" DCU-DetId map is empty!";
324 Analyses::iterator ianal =
data().begin();
325 Analyses::iterator janal =
data().end();
326 for ( ; ianal != janal; ++ianal ) {
329 if ( !ianal->second->isValid() ) {
continue; }
336 <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
337 <<
" NULL pointer to FastFedCablingAnalysis object!";
343 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
344 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
345 while ( !found && idcu != jdcu ) {
346 dcuDescription* dcu =
dynamic_cast<dcuDescription*
>( *idcu );
348 if ( dcu->getDcuType() ==
"FEH" ) {
349 if ( dcu->getDcuHardId() == anal->
dcuHardId() ) {
351 anal->
dcuId( dcu->getDcuHardId() );
360 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
362 if ( idet != detids.end() ) { anal->
detId( idet->second->getDetId() ); }
379 if ( !anal ) {
return; }
386 for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
389 FastFedCablingAnalysisDescription*
tmp;
390 tmp =
new FastFedCablingAnalysisDescription( anal->
highLevel(),
417 typedef std::vector<std::string>
Strings;
419 Strings::const_iterator istr = errors.begin();
420 Strings::const_iterator jstr = errors.end();
421 for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
424 desc.push_back( tmp );
436 std::vector<std::string>
valid;
437 std::vector<std::string> dirty;
438 std::vector<std::string> trimdac;
439 std::vector<std::string>
missing;
440 std::vector<std::string> devices;
441 uint32_t missing_pairs = 0;
444 std::vector<uint32_t> found_dcus;
445 Analyses::iterator ianal =
data().begin();
446 Analyses::iterator janal =
data().end();
447 for ( ; ianal != janal; ++ianal ) {
451 if ( !anal ) {
continue; }
454 std::stringstream
ss;
457 ss <<
"DcuId= " << std::hex << std::setw(8) << std::setfill(
'0') << anal->
dcuId() << std::dec <<
" ";
458 ss <<
"DetId= " << std::hex << std::setw(8) << std::setfill(
'0') << anal->
detId() << std::dec;
461 !(anal->
badTrimDac()) ) { valid.push_back( ss.str() ); }
462 if ( anal->
isDirty() ) { dirty.push_back( ss.str() ); }
463 if ( anal->
badTrimDac() ) { trimdac.push_back( ss.str() ); }
466 found_dcus.push_back( anal->
dcuHardId() );
471 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
472 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
473 for ( ; idcu != jdcu; ++idcu ) {
476 dcuDescription* dcu =
dynamic_cast<dcuDescription*
>( *idcu );
477 if ( !dcu ) {
continue; }
478 if ( dcu->getDcuType() !=
"FEH" ) {
continue; }
482 std::vector<uint32_t>::const_iterator
iter =
find( found_dcus.begin(), found_dcus.end(), dcu->getDcuHardId() );
483 if ( iter != found_dcus.end() ) {
continue; }
486 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
488 if ( idet == detids.end() ) {
continue; }
489 if ( idet->second ) {
continue; }
492 uint16_t npairs = idet->second->getApvNumber()/2;
496 addrs.resize(6,
false);
498 SiStripConfigDb::DeviceDescriptionsV::const_iterator iapv = apvs.begin();
499 SiStripConfigDb::DeviceDescriptionsV::const_iterator japv = apvs.end();
500 for ( ; iapv != japv; ++iapv ) {
501 apvDescription* apv =
dynamic_cast<apvDescription*
>( *iapv );
502 if ( !apv ) {
continue; }
509 uint16_t pos = apv_addr.
i2cAddr_ - 32;
510 if ( pos < 6 ) { addrs[pos] =
true; }
516 if ( addrs[0] || addrs[1] ) {
518 std::stringstream
ss;
525 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
526 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
527 missing.push_back( ss.str() );
529 if ( addrs[2] || addrs[3] ) {
531 std::stringstream
ss;
538 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
539 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
540 missing.push_back( ss.str() );
542 if ( addrs[4] || addrs[5] ) {
544 std::stringstream
ss;
551 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
552 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
553 missing.push_back( ss.str() );
556 if ( pairs != npairs ) {
558 missing_pairs = npairs -
pairs;
561 std::stringstream
ss;
568 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
569 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
570 devices.push_back( ss.str() );
574 std::stringstream
ss;
581 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
582 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
583 devices.push_back( ss.str() );
586 if ( !addrs[2] && npairs == 3 ) {
587 std::stringstream
ss;
594 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
595 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
596 devices.push_back( ss.str() );
599 if ( !addrs[3] && npairs == 3 ) {
600 std::stringstream
ss;
607 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
608 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
609 devices.push_back( ss.str() );
613 std::stringstream
ss;
620 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
621 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
622 devices.push_back( ss.str() );
626 std::stringstream
ss;
633 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() << std::dec;
634 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first << std::dec;
635 devices.push_back( ss.str() );
644 std::stringstream
ss;
645 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
646 <<
" Summary of connections: " << std::endl
647 <<
" \"Good\" connections : " << valid.size() << std::endl
648 <<
" \"Dirty\" connections : " << dirty.size() << std::endl
649 <<
" \"Bad\" TrimDAQ settings : " << trimdac.size() << std::endl
650 <<
" (\"Missing\" connections : " << missing.size() <<
")" << std::endl
651 <<
" (\"Missing\" APV pairs : " << missing_pairs <<
")" << std::endl
652 <<
" (\"Missing\" APVs : " << devices.size() <<
")" << std::endl;
657 if ( !valid.empty() ) {
658 std::stringstream
ss;
659 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
660 <<
" List of \"good\" connections: " << std::endl;
661 std::vector<std::string>::const_iterator istr = valid.begin();
662 std::vector<std::string>::const_iterator jstr = valid.end();
663 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
668 if ( !dirty.empty() ) {
669 std::stringstream
ss;
670 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
671 <<
" List of \"dirty\" connections: " << std::endl;
672 std::vector<std::string>::const_iterator istr = dirty.begin();
673 std::vector<std::string>::const_iterator jstr = dirty.end();
674 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
679 if ( !trimdac.empty() ) {
680 std::stringstream
ss;
681 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
682 <<
" List of \"bad\" TrimDAC settings: " << std::endl;
683 std::vector<std::string>::const_iterator istr = trimdac.begin();
684 std::vector<std::string>::const_iterator jstr = trimdac.end();
685 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
690 if ( !missing.empty() ) {
691 std::stringstream
ss;
692 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
693 <<
" List of \"missing\" connections: " << std::endl;
694 std::vector<std::string>::const_iterator istr = missing.begin();
695 std::vector<std::string>::const_iterator jstr = missing.end();
696 for ( ; istr != jstr; ++istr ) { ss << *istr << std::endl; }
701 if ( !devices.empty() ) {
702 std::stringstream
ss;
703 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
704 <<
" List of \"missing\" APVs: " << std::endl;
705 std::vector<std::string>::const_iterator istr = devices.begin();
706 std::vector<std::string>::const_iterator jstr = devices.end();
707 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()
list pairs
sort tag files by run number
DcuDetIdsRange getDcuDetIds(std::string partition="")
SiStripFedCabling *const cabling() const
const VString & getErrorCodes() const
virtual void terse(std::stringstream &ss) const
static const float threshold_