13 if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
14 (dbParams_.usingDbCache() && !databaseCache(__func__))) {
15 return devices_.emptyRange();
19 if (!dbParams_.usingDbCache()) {
20 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
21 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
22 for (; iter != jter; ++iter) {
29 if (
range == devices_.emptyRange()) {
32 deviceFactory(__func__)->getFecDeviceDescriptions(iter->second.partitionName(),
34 iter->second.fecVersion().first,
35 iter->second.fecVersion().second,
37 iter->second.maskVersion().first,
38 iter->second.maskVersion().second,
44 FecFactory::vectorCopyI(tmp2, tmp1,
true);
47 devices_.loadNext(iter->second.partitionName(), tmp2);
52 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 53 <<
" Downloaded " <<
range.size() <<
" device descriptions to local cache for partition \"" 54 << iter->second.partitionName() <<
"\"" << std::endl;
55 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 56 <<
" Cache holds device descriptions for " << devices_.size() <<
" partitions.";
69 FecFactory::vectorCopyI(tmp2, *tmp1,
true);
76 <<
" NULL pointer to DeviceDescriptions vector!";
81 handleException(__func__);
93 if (!devices_.empty()) {
95 devices_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
97 devs = devices_.emptyRange();
104 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 105 <<
" Found " << nc <<
" device descriptions";
106 if (!dbParams_.usingDb()) {
107 ss <<
" in " << dbParams_.inputFecXmlFiles().size() <<
" 'fec.xml' file(s)";
109 if (!dbParams_.usingDbCache()) {
110 ss <<
" in " <<
np <<
" database partition(s)";
112 ss <<
" from shared memory name '" << dbParams_.sharedMemory() <<
"'";
115 if (devices_.empty()) {
128 typedDevices_.clear();
138 if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
139 (dbParams_.usingDbCache() && !databaseCache(__func__))) {
147 typedDevices_ = FecFactory::getDeviceFromDeviceVector(
tmp, device_type);
150 handleException(__func__);
153 if (device_type == APV25) {
154 apvDevices_.swap(typedDevices_);
156 }
else if (device_type == APVMUX) {
157 muxDevices_.swap(typedDevices_);
159 }
else if (device_type == DCU) {
160 dcuDevices_.swap(typedDevices_);
162 }
else if (device_type == LASERDRIVER) {
163 lldDevices_.swap(typedDevices_);
165 }
else if (device_type == PLL) {
166 pllDevices_.swap(typedDevices_);
168 }
else if (device_type == DOH) {
169 dohDevices_.swap(typedDevices_);
188 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 189 <<
" Extracted " <<
tmp.size() <<
" device descriptions (for devices of type " << deviceType(device_type) <<
")";
198 if (!deviceFactory(__func__)) {
204 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 205 <<
" Partition string is empty," 206 <<
" therefore cannot add device descriptions to local cache!";
213 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 214 <<
" Vector of device descriptions is empty," 215 <<
" therefore cannot add device descriptions to local cache!";
220 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
221 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
222 for (; iter != jter; ++iter) {
223 if (
partition == iter->second.partitionName()) {
227 if (iter == dbParams_.partitions().end()) {
229 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 230 <<
" Partition \"" <<
partition <<
"\" not found in partition list, " 231 <<
" therefore cannot add device descriptions!";
237 if (
range == devices_.emptyRange()) {
240 FecFactory::vectorCopyI(
tmp, devs,
true);
246 std::stringstream
ss;
247 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 248 <<
" Added " << devs.size() <<
" device descriptions to local cache for partition \"" <<
partition <<
"\"." 249 <<
" (Cache holds device descriptions for " << devices_.size() <<
" partitions.)";
254 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 255 <<
" Partition \"" <<
partition <<
"\" already found in local cache, " 256 <<
" therefore cannot add device descriptions!";
265 if (dbParams_.usingDbCache()) {
267 <<
" Using database cache! No uploads allowed!";
271 if (!deviceFactory(__func__)) {
275 if (devices_.empty()) {
277 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 278 <<
" Found no cached device descriptions, therefore no upload!";
284 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
285 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
286 for (; iter != jter; ++iter) {
289 if (
range != devices_.emptyRange()) {
293 deviceFactory(__func__)->setFecDeviceDescriptions(devs,
294 iter->second.partitionName(),
296 &(fecVersion.second),
300 std::stringstream
ss;
301 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 302 <<
" Uploaded " << devs.size() <<
" device descriptions to database for partition \"" 303 << iter->second.partitionName() <<
"\".";
308 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 309 <<
" Vector of device descriptions is empty for partition \"" << iter->second.partitionName()
310 <<
"\", therefore aborting upload for this partition!";
327 handleException(__func__);
330 allowCalibUpload_ =
true;
338 if (devices_.empty()) {
340 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 341 <<
" Found no cached device descriptions!";
351 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
352 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
353 for (; iter != jter; ++iter) {
354 if (
partition != iter->second.partitionName()) {
356 if (
range != devices_.emptyRange()) {
372 if (!devices_.empty()) {
374 devices_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
376 devs = devices_.emptyRange();
379 SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
380 SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
381 for (; iter != jter; ++iter) {
382 if (
partition == iter->second.partitionName()) {
386 devs = devices_.find(iter->second.partitionName());
389 if (devs != devices_.emptyRange()) {
390 DeviceDescriptionsV::const_iterator ifed = devs.begin();
391 DeviceDescriptionsV::const_iterator jfed = devs.end();
392 for (; ifed != jfed; ++ifed) {
399 ss <<
"[SiStripConfigDb::" << __func__ <<
"]";
401 ss <<
" Found no device descriptions in local cache!";
403 ss <<
" Found no device descriptions in local cache for partition \"" <<
partition <<
"\"!";
409 devices_ = temporary_cache;
415 std::stringstream
ss;
416 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 417 <<
" Contents of DeviceDescriptions container:" << std::endl;
418 ss <<
" Number of partitions: " << devices_.size() << std::endl;
424 for (; idev != jdev; ++idev) {
427 ss <<
" Partition number : " << cntr <<
" (out of " << devices_.size() <<
")" << std::endl;
428 ss <<
" Partition name : \"" << idev->first <<
"\"" << std::endl;
429 ss <<
" Num of devices : " << idev->second.size() << std::endl;
432 std::map<uint32_t, vector<std::string> >
devices;
433 DeviceDescriptionsV::const_iterator iter = idev->second.begin();
434 DeviceDescriptionsV::const_iterator jter = idev->second.end();
435 for (; iter != jter; ++iter) {
439 std::stringstream
data;
440 data << (*iter)->getDeviceType() <<
"_" 456 std::map<uint32_t, std::vector<std::string> >
tmp;
457 std::map<uint32_t, std::vector<std::string> >::const_iterator
ii =
devices.begin();
458 std::map<uint32_t, std::vector<std::string> >::const_iterator
jj =
devices.end();
460 std::vector<std::string>
temp =
ii->second;
462 std::vector<std::string>::const_iterator iii =
temp.begin();
463 std::vector<std::string>::const_iterator jjj =
temp.end();
464 for (; iii != jjj; ++iii) {
465 tmp[
ii->first].push_back(*iii);
472 std::map<uint32_t, std::vector<std::string> >::const_iterator idev =
devices.begin();
473 std::map<uint32_t, std::vector<std::string> >::const_iterator jdev =
devices.end();
474 for (; idev != jdev; ++idev) {
476 ss <<
" Found " << std::setw(3) << idev->second.size() <<
" devices for FEC crate/slot/ring " <<
key.fecCrate()
477 <<
"/" <<
key.fecSlot() <<
"/" <<
key.fecRing();
509 addr.fecSlot_ =
static_cast<uint16_t
>(
desc.getFecSlot());
511 addr.ccuAddr_ =
static_cast<uint16_t
>(
desc.getCcuAddress());
512 addr.ccuChan_ =
static_cast<uint16_t
>(
desc.getChannel());
514 addr.i2cAddr_ =
static_cast<uint16_t
>(
desc.getAddress());
516 handleException(__func__);
525 if (device_type == PLL) {
527 }
else if (device_type == LASERDRIVER) {
529 }
else if (device_type == DOH) {
531 }
else if (device_type == APVMUX) {
533 }
else if (device_type == APV25) {
535 }
else if (device_type == DCU) {
537 }
else if (device_type == GOH) {
540 return "UNKNOWN DEVICE!";
static const std::string defaultPartitionName_
void loadNext(K const &k, std::vector< T > const &v)
void addDeviceDescriptions(std::string partition, DeviceDescriptionsV &)
static const uint16_t FEC_RING_OFFSET
void clearDeviceDescriptions(std::string partition="")
const uint16_t & lldChan() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static const char mlConfigDb_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
enumDeviceType DeviceType
DeviceDescriptions::range DeviceDescriptionsRange
const uint32_t & key() const
key
prepare the HTCondor submission files and eventually submit them
DeviceAddress deviceAddress(const deviceDescription &)
std::pair< uint32_t, uint32_t > Versions
char data[epos_bytes_allocation]
void printDeviceDescriptions(std::string partition="")
static const uint16_t FEC_CRATE_OFFSET
std::string deviceType(const enumDeviceType &device_type) const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning
void uploadDeviceDescriptions(std::string partition="")
std::vector< DeviceDescription * > DeviceDescriptionsV