7 using namespace sistrip;
14 if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
15 ( dbParams_.usingDbCache() && !databaseCache(__func__) ) ) {
16 return dcuDetIds_.emptyRange();
21 if ( !dbParams_.usingDbCache() ) {
23 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
24 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
25 for ( ; iter != jter; ++iter ) {
27 if ( partition ==
"" || partition == iter->second.partitionName() ) {
31 DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
32 if ( range == dcuDetIds_.emptyRange() ) {
34 deviceFactory(__func__)->addDetIdPartition( iter->second.partitionName(),
35 iter->second.dcuVersion().first,
36 iter->second.dcuVersion().second );
46 dcuDetIds_.loadNext( iter->second.partitionName(), dst );
70 <<
"[SiStripConfigDb::" << __func__ <<
"]"
71 <<
" NULL pointer to Dcu-DetId map!";
76 }
catch (... ) { handleException( __func__ ); }
82 if ( partition !=
"" ) {
83 range = dcuDetIds_.find( partition );
87 if ( !dcuDetIds_.empty() ) {
88 range =
DcuDetIdsRange( dcuDetIds_.find( dbParams_.partitions().begin()->second.partitionName() ).
begin(),
89 dcuDetIds_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).
end() );
90 }
else { range = dcuDetIds_.emptyRange(); }
91 np = dcuDetIds_.size();
96 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
97 <<
" Found " << nc <<
" entries in DCU-DetId map";
98 if ( !dbParams_.usingDb() ) { ss <<
" in " << dbParams_.inputDcuInfoXmlFiles().size() <<
" 'module.xml' file(s)"; }
99 else {
if ( !dbParams_.usingDbCache() ) { ss <<
" in " << np <<
" database partition(s)"; }
100 else { ss <<
" from shared memory name '" << dbParams_.sharedMemory() <<
"'"; } }
112 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
113 <<
" Cannot add to local cache! This functionality not allowed!";
187 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
188 <<
" Cannot upload to database! This functionality not allowed!";
276 if ( dcuDetIds_.empty() ) {
278 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
279 <<
" Found no cached DCU-DetId map!";
286 if ( partition ==
"" ) { temporary_cache =
DcuDetIds(); }
288 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
289 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
290 for ( ; iter != jter; ++iter ) {
291 if ( partition != iter->second.partitionName() ) {
292 DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
293 if ( range != dcuDetIds_.emptyRange() ) {
308 if ( partition ==
"" ) {
309 if ( !dcuDetIds_.empty() ) {
310 dcus =
DcuDetIdsRange( dcuDetIds_.find( dbParams_.partitions().begin()->second.partitionName() ).
begin(),
311 dcuDetIds_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).
end() );
312 }
else { dcus = dcuDetIds_.emptyRange(); }
314 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
315 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
316 for ( ; iter != jter; ++iter ) {
if ( partition == iter->second.partitionName() ) {
break; } }
317 dcus = dcuDetIds_.find( iter->second.partitionName() );
320 if ( dcus != dcuDetIds_.emptyRange() ) {
321 DcuDetIdsV::const_iterator ifed = dcus.begin();
322 DcuDetIdsV::const_iterator jfed = dcus.end();
323 for ( ; ifed != jfed; ++ifed ) {
if ( ifed->second ) {
delete ifed->second; } }
326 ss <<
"[SiStripConfigDb::" << __func__ <<
"]";
327 if ( partition ==
"" ) { ss <<
" Found no DCU-DetId map in local cache!"; }
328 else { ss <<
" Found no DCU-DetId map in local cache for partition \"" << partition <<
"\"!"; }
333 dcuDetIds_ = temporary_cache;
341 std::stringstream ss;
342 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
343 <<
" Contents of DcuDetIds container:" << std::endl;
344 ss <<
" Number of partitions: " << dcuDetIds_.size() << std::endl;
350 for ( ; idcu != jdcu; ++idcu ) {
353 if ( partition ==
"" || partition == idcu->first ) {
355 ss <<
" Partition number : " << cntr <<
" (out of " << dcuDetIds_.size() <<
")" << std::endl;
356 ss <<
" Partition name : \"" << idcu->first <<
"\"" << std::endl;
357 ss <<
" Size of DCU-DetId map : " << idcu->second.size() << std::endl;
371 DcuDetIdMap::const_iterator
ii = input.begin();
372 DcuDetIdMap::const_iterator
jj = input.end();
373 for ( ; ii !=
jj; ++
ii ) {
if ( ii->second ) { output.push_back( std::make_pair( ii->first,
new TkDcuInfo( *(ii->second) ) ) ); } }
380 DcuDetIdsV::const_iterator
ii = input.begin();
381 DcuDetIdsV::const_iterator
jj = input.end();
382 for ( ; ii !=
jj; ++
ii ) {
if ( ii->second ) { output[ii->first] =
new TkDcuInfo( *(ii->second) ); } }
389 DcuDetIdsV::const_iterator
ii = input.begin();
390 DcuDetIdsV::const_iterator
jj = input.end();
391 for ( ; ii !=
jj; ++
ii ) {
if ( ii->second ) { output.push_back( std::make_pair( ii->first,
new TkDcuInfo( *(ii->second) ) ) ); } }
397 DcuDetIdsV::const_iterator
end,
399 DcuDetIdsV::const_iterator iter =
begin;
400 DcuDetIdsV::const_iterator jter =
end;
401 for ( ; iter != jter; ++iter ) {
402 if ( iter->second && iter->second->getDcuHardId() == dcu_id ) {
return iter; }
410 DcuDetIdsV::iterator
end,
412 DcuDetIdsV::iterator iter =
begin;
413 DcuDetIdsV::iterator jter =
end;
414 for ( ; iter != jter; ++iter ) {
415 if ( iter->second && iter->second->getDcuHardId() == dcu_id ) {
return iter; }
void clone(const DcuDetIdMap &in, DcuDetIdsV &out) const
static std::string defaultPartitionName_
DcuDetIds::range DcuDetIdsRange
void loadNext(K const &k, std::vector< T > const &v)
void uploadDcuDetIds(std::string partition="")
static const char mlConfigDb_[]
static DcuDetIdsV::const_iterator findDcuDetId(DcuDetIdsV::const_iterator begin, DcuDetIdsV::const_iterator end, uint32_t dcu_id)
void printDcuDetIds(std::string partition="")
std::vector< DcuDetId > DcuDetIdsV
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Sgi::hash_map< unsigned long, TkDcuInfo * > DcuDetIdMap
void addDcuDetIds(std::string partition, DcuDetIdsV &)
void clearDcuDetIds(std::string partition="")
DcuDetIdsRange getDcuDetIds(std::string partition="")