6 using namespace sistrip;
12 if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
13 (dbParams_.usingDbCache() && !databaseCache(__func__))) {
14 return dcuDetIds_.emptyRange();
18 if (!dbParams_.usingDbCache()) {
19 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
20 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
21 for (; iter != jter; ++iter) {
22 if (partition.empty() || partition == iter->second.partitionName()) {
28 if (range == dcuDetIds_.emptyRange()) {
29 deviceFactory(__func__)->addDetIdPartition(
30 iter->second.partitionName(), iter->second.dcuVersion().first, iter->second.dcuVersion().second);
40 dcuDetIds_.loadNext(iter->second.partitionName(),
dst);
60 <<
" NULL pointer to Dcu-DetId map!";
65 handleException(__func__);
72 if (!partition.empty()) {
73 range = dcuDetIds_.find(partition);
77 if (!dcuDetIds_.empty()) {
78 range =
DcuDetIdsRange(dcuDetIds_.find(dbParams_.partitions().begin()->second.partitionName()).
begin(),
79 dcuDetIds_.find((--(dbParams_.partitions().end()))->second.partitionName()).
end());
81 range = dcuDetIds_.emptyRange();
83 np = dcuDetIds_.size();
88 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
89 <<
" Found " << nc <<
" entries in DCU-DetId map";
90 if (!dbParams_.usingDb()) {
91 ss <<
" in " << dbParams_.inputDcuInfoXmlFiles().size() <<
" 'module.xml' file(s)";
93 if (!dbParams_.usingDbCache()) {
94 ss <<
" in " << np <<
" database partition(s)";
96 ss <<
" from shared memory name '" << dbParams_.sharedMemory() <<
"'";
99 if (dcuDetIds_.empty()) {
112 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
113 <<
" Cannot add to local cache! This functionality not allowed!";
185 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
186 <<
" Cannot upload to database! This functionality not allowed!";
273 if (dcuDetIds_.empty()) {
275 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
276 <<
" Found no cached DCU-DetId map!";
283 if (partition.empty()) {
286 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
287 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
288 for (; iter != jter; ++iter) {
289 if (partition != iter->second.partitionName()) {
291 if (range != dcuDetIds_.emptyRange()) {
306 if (partition.empty()) {
307 if (!dcuDetIds_.empty()) {
308 dcus =
DcuDetIdsRange(dcuDetIds_.find(dbParams_.partitions().begin()->second.partitionName()).
begin(),
309 dcuDetIds_.find((--(dbParams_.partitions().end()))->second.partitionName()).
end());
311 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) {
317 if (partition == iter->second.partitionName()) {
321 dcus = dcuDetIds_.find(iter->second.partitionName());
324 if (dcus != dcuDetIds_.emptyRange()) {
325 DcuDetIdsV::const_iterator ifed = dcus.begin();
326 DcuDetIdsV::const_iterator jfed = dcus.end();
327 for (; ifed != jfed; ++ifed) {
334 ss <<
"[SiStripConfigDb::" << __func__ <<
"]";
335 if (partition.empty()) {
336 ss <<
" Found no DCU-DetId map in local cache!";
338 ss <<
" Found no DCU-DetId map in local cache for partition \"" << partition <<
"\"!";
344 dcuDetIds_ = temporary_cache;
350 std::stringstream
ss;
351 ss <<
"[SiStripConfigDb::" << __func__ <<
"]"
352 <<
" Contents of DcuDetIds container:" << std::endl;
353 ss <<
" Number of partitions: " << dcuDetIds_.size() << std::endl;
359 for (; idcu != jdcu; ++idcu) {
361 if (partition.empty() || partition == idcu->first) {
362 ss <<
" Partition number : " << cntr <<
" (out of " << dcuDetIds_.size() <<
")" << std::endl;
363 ss <<
" Partition name : \"" << idcu->first <<
"\"" << std::endl;
364 ss <<
" Size of DCU-DetId map : " << idcu->second.size() << std::endl;
375 DcuDetIdMap::const_iterator
ii = input.begin();
376 DcuDetIdMap::const_iterator
jj = input.end();
377 for (; ii !=
jj; ++
ii) {
379 output.push_back(std::make_pair(ii->first,
new TkDcuInfo(*(ii->second))));
388 DcuDetIdsV::const_iterator
ii = input.begin();
389 DcuDetIdsV::const_iterator
jj = input.end();
390 for (; ii !=
jj; ++
ii) {
392 output[ii->first] =
new TkDcuInfo(*(ii->second));
401 DcuDetIdsV::const_iterator
ii = input.begin();
402 DcuDetIdsV::const_iterator
jj = input.end();
403 for (; ii !=
jj; ++
ii) {
405 output.push_back(std::make_pair(ii->first,
new TkDcuInfo(*(ii->second))));
413 DcuDetIdsV::const_iterator
end,
415 DcuDetIdsV::const_iterator iter =
begin;
416 DcuDetIdsV::const_iterator jter =
end;
417 for (; iter != jter; ++iter) {
418 if (iter->second && iter->second->getDcuHardId() == dcu_id) {
428 DcuDetIdsV::iterator
end,
430 DcuDetIdsV::iterator iter =
begin;
431 DcuDetIdsV::iterator jter =
end;
432 for (; iter != jter; ++iter) {
433 if (iter->second && iter->second->getDcuHardId() == dcu_id) {
void clone(const DcuDetIdMap &in, DcuDetIdsV &out) const
static const std::string defaultPartitionName_
DcuDetIds::range DcuDetIdsRange
void loadNext(K const &k, std::vector< T > const &v)
Sgi::hash_map< unsigned long, TkDcuInfo * > DcuDetIdMap
void uploadDcuDetIds(std::string partition="")
static std::string const input
const uint16_t range(const Frame &aFrame)
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)
void addDcuDetIds(std::string partition, DcuDetIdsV &)
void clearDcuDetIds(std::string partition="")
Log< level::Warning, false > LogWarning
DcuDetIdsRange getDcuDetIds(std::string partition="")