41 openConnection_(
false) {
44 <<
" Constructing database service..." 45 <<
" (Class instance: " <<
count <<
")";
61 <<
" Destructing object...";
100 <<
" Opening connection to database...";
105 <<
" Connection already open!";
121 std::stringstream
ss;
122 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 123 <<
" Database connection parameters: " << std::endl
131 <<
" Opened connection to database!";
138 <<
" Closing connection to database...";
143 <<
" No connection open!";
156 handleException(__func__,
"Attempting to delete DeviceFactory object...");
170 <<
" Closed connection to database...";
177 <<
" Clearing local caches...";
195 if (!method_name.empty()) {
197 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 198 <<
" NULL pointer to DeviceFactory requested by" 199 <<
" method SiStripConfigDb::" << method_name <<
"()!";
212 if (!method_name.empty()) {
214 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 215 <<
" NULL pointer to DbClient requested by" 216 <<
" method SiStripConfigDb::" << method_name <<
"()!";
233 std::stringstream
ss;
234 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 235 <<
" Setting \"user/passwd@path\" to \"" <<
user <<
"/" << pToPrint <<
"@" <<
path 236 <<
"\" using 'CONFDB' environmental variable";
239 <<
"\" read from .cfg file)";
245 std::stringstream
ss;
246 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 248 <<
"\" using 'ConfDb' configurable read from .cfg file";
253 <<
" Unable to retrieve 'user/passwd@path' parameters" 254 <<
" from 'CONFDB' environmental variable or .cfg file" 255 <<
" (present value is \"" <<
user <<
"/" << pToPrint <<
"@" <<
path 256 <<
"\"). Aborting connection to database...";
262 std::string tns_admin =
"/afs/cern.ch/project/oracle/admin";
263 if (std::getenv(
pattern.c_str()) !=
nullptr) {
264 tns_admin = std::getenv(
pattern.c_str());
266 <<
" TNS_ADMIN is set to: \"" << tns_admin <<
"\"";
269 <<
" TNS_ADMIN is not set!" 270 <<
" Trying to use /afs and setting to: \"" << tns_admin <<
"\"";
275 std::stringstream
ss;
276 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 277 <<
" Overriding TNS_ADMIN value using cfg file!" << std::endl
278 <<
" Original value : \"" << tns_admin <<
"\"!" << std::endl
285 if (tns_admin.empty()) {
290 tns_admin = tns_admin.substr(0, tns_admin.size() - 1);
292 setenv(
pattern.c_str(), tns_admin.c_str(), 1);
296 std::ifstream tnsnames_ora(
filename.c_str());
298 if (tnsnames_ora.is_open()) {
300 while (!tnsnames_ora.eof()) {
301 getline(tnsnames_ora,
line);
308 <<
" Cannot open file \"" <<
filename <<
"\"";
316 <<
" Cannot find database account \"" <<
dbParams_.
path() <<
"\" in file \"" 318 <<
" Aborting connection to database...";
325 <<
" Creating DeviceFactory object...";
328 <<
" Created DeviceFactory object!";
330 std::stringstream
ss;
331 ss <<
"Failed to connect to database using parameters '" <<
dbParams_.
user() <<
"/" << pToPrint <<
"@" 339 std::stringstream
ss;
340 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 341 <<
" DeviceFactory created at address 0x" << std::hex << std::setw(8) << std::setfill(
'0') <<
factory_ 342 <<
std::dec <<
", using database account with parameters '" <<
dbParams_.
user() <<
"/" << pToPrint <<
"@" 347 <<
" NULL pointer to DeviceFactory!" 348 <<
" Unable to connect to database using connection parameters '" <<
dbParams_.
user()
349 <<
"/" << pToPrint <<
"@" <<
dbParams_.
path() <<
"' and partitions '" 362 if (std::getenv(
partition.c_str()) !=
nullptr) {
363 std::stringstream
ss;
364 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 365 <<
" Setting \"partitions\" to \"" << std::getenv(
partition.c_str())
366 <<
"\" using 'ENV_CMS_TK_PARTITION' environmental variable";
369 <<
"\" read from .cfg file)";
377 std::vector<std::string>::iterator
ii =
partitions.begin();
378 std::vector<std::string>::iterator
jj =
partitions.end();
386 std::stringstream
ss;
387 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 389 <<
"\" using 'PartitionName' configurables read from .cfg file";
393 <<
" Unable to retrieve 'partition' parameter" 394 <<
" from 'CONFDB' environmental variable or .cfg file!" 395 <<
" Aborting connection to database...";
402 for (; ip != jp; ++ip) {
403 ip->second.update(
this);
423 std::stringstream
ss;
424 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 425 <<
" Empty string for shared memory name!" 426 <<
" Cannot accept shared memory!";
434 <<
" Creating DbClient object...";
437 <<
" Created DbClient object...";
439 std::stringstream
ss;
447 std::stringstream
ss;
448 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 449 <<
" DbClient object created at address 0x" << std::hex << std::setw(8) << std::setfill(
'0') <<
dbCache_ 454 <<
" NULL pointer to DbClient object!" 455 <<
" Unable to connect to database cache using shared memory name '" 464 handleException(__func__,
"Attempted to called DbClient::parse() method");
472 <<
" Using XML description files...";
478 handleException(__func__,
"Attempting to create DeviceFactory for use with xml files");
483 std::stringstream
ss;
484 ss <<
"[SiStripConfigDb::" << __func__ <<
"]" 485 <<
" DeviceFactory created at address 0x" << std::hex << std::setw(8) << std::setfill(
'0') <<
factory_ 486 <<
std::dec <<
", using XML description files";
490 <<
" NULL pointer to DeviceFactory!" 491 <<
" Unable to connect to database!";
504 for (; ip != jp; ++ip) {
506 if (ip->second.inputModuleXml().empty()) {
508 <<
" NULL path to input 'module.xml' file!";
512 deviceFactory(__func__)->addConnectionFileName(ip->second.inputModuleXml());
517 <<
" Added input 'module.xml' file: " << ip->second.inputModuleXml();
520 <<
" No 'module.xml' file found at " << ip->second.inputModuleXml();
521 ip->second.inputModuleXml() =
"";
526 if (ip->second.inputDcuInfoXml().empty()) {
528 <<
" NULL path to input 'dcuinfo.xml' file!";
532 deviceFactory(__func__)->addTkDcuInfoFileName(ip->second.inputDcuInfoXml());
537 <<
" Added 'dcuinfo.xml' file: " << ip->second.inputDcuInfoXml();
540 <<
" No 'dcuinfo.xml' file found at " << ip->second.inputDcuInfoXml();
541 ip->second.inputDcuInfoXml() =
"";
546 if (ip->second.inputFecXml().empty()) {
548 <<
" NULL paths to input 'fec.xml' files!";
550 for (
const auto& iter : ip->second.inputFecXml()) {
553 <<
" NULL path to input 'fec.xml' file!";
562 <<
" Added 'fec.xml' file: " << iter;
565 <<
" No 'fec.xml' file found at " << iter;
572 if (ip->second.inputFedXml().empty()) {
574 <<
" NULL paths to input 'fed.xml' files!";
576 for (
const auto& iter : ip->second.inputFedXml()) {
579 <<
" NULL path to input 'fed.xml' file!";
588 <<
" Added 'fed.xml' file: " << iter;
591 <<
" No 'fed.xml' file found at " << iter;
601 <<
" NULL path to output 'module.xml' file!" 602 <<
" Setting to '/tmp/module.xml'...";
609 handleException(__func__,
"Problems setting output 'module.xml' file!");
616 <<
" NULL path to output 'dcuinfo.xml' file!" 617 <<
" Setting to '/tmp/dcuinfo.xml'...";
624 handleException(__func__,
"Problems setting output 'dcuinfo.xml' file!");
631 <<
" NULL path to output 'fec.xml' file!" 632 <<
" Setting to '/tmp/fec.xml'...";
646 <<
" NULL path to output 'fed.xml' file!" 647 <<
" Setting to '/tmp/fed.xml'...";
651 Fed9U::Fed9UDeviceFactory* factory =
deviceFactory(__func__);
662 std::stringstream
ss;
668 ss <<
" Caught cms::Exception in method " << method_name <<
" with message: " << std::endl <<
e.what();
669 if (!extra_info.empty()) {
670 ss <<
"Additional info: " << extra_info << std::endl;
675 catch (
const oracle::occi::SQLException&
e) {
676 ss <<
" Caught oracle::occi::SQLException in method " << method_name <<
" with message: " << std::endl
678 if (!extra_info.empty()) {
679 ss <<
"Additional info: " << extra_info << std::endl;
684 catch (
const FecExceptionHandler&
e) {
685 ss <<
" Caught FecExceptionHandler exception in method " << method_name <<
" with message: " << std::endl
686 <<
const_cast<FecExceptionHandler&
>(
e).what();
687 if (!extra_info.empty()) {
688 ss <<
"Additional info: " << extra_info << std::endl;
701 catch (
const ICUtils::ICException&
e) {
702 ss <<
" Caught ICUtils::ICException in method " << method_name <<
" with message: " << std::endl <<
e.what();
703 if (!extra_info.empty()) {
704 ss <<
"Additional info: " << extra_info << std::endl;
710 ss <<
" Caught std::exception in method " << method_name <<
" with message: " << std::endl <<
e.what();
711 if (!extra_info.empty()) {
712 ss <<
"Additional info: " << extra_info << std::endl;
718 ss <<
" Caught unknown exception in method " << method_name <<
" (No message) " << std::endl;
719 if (!extra_info.empty()) {
720 ss <<
"Additional info: " << extra_info << std::endl;
750 <<
" NULL pointer to DeviceFactory object!";
756 all =
df->getAllRuns();
759 tkRunVector::const_iterator
ii =
all.begin();
760 tkRunVector::const_iterator
jj =
all.end();
765 uint16_t
type = (*ii)->getModeId((*ii)->getMode());
769 }
else if (
type == 2) {
771 }
else if (
type == 3) {
773 }
else if (
type == 33) {
775 }
else if (
type == 4) {
777 }
else if (
type == 5) {
779 }
else if (
type == 6) {
781 }
else if (
type == 7) {
783 }
else if (
type == 10) {
785 }
else if (
type == 8) {
787 }
else if (
type == 12) {
789 }
else if (
type == 13) {
791 }
else if (
type == 14) {
793 }
else if (
type == 15) {
795 }
else if (
type == 16) {
797 }
else if (
type == 17) {
799 }
else if (
type == 18) {
801 }
else if (
type == 19) {
803 }
else if (
type == 20) {
805 }
else if (
type == 21) {
807 }
else if (
type == 0) {
816 r.partition_ = (*ii)->getPartitionName();
817 r.number_ = (*ii)->getRunNumber();
822 <<
" NULL pointer to TkRun object!";
835 if (!optional_partition.empty()) {
836 SiStripDbParams::SiStripPartitions::const_iterator iter =
dbParams_.
partition(optional_partition);
839 <<
" Partition name not found!";
845 Runs::const_iterator
ii =
in.begin();
846 Runs::const_iterator
jj =
in.end();
849 if (
ii->partition_ == optional_partition || optional_partition.empty()) {
855 if (
out.find(
ii->type_) !=
out.end()) {
856 Runs::const_iterator irun =
out[
ii->type_].begin();
857 Runs::const_iterator jrun =
out[
ii->type_].end();
858 while (!
found && irun != jrun) {
859 if (irun->number_ ==
ii->number_) {
899 Runs::const_iterator
ii =
in.begin();
900 Runs::const_iterator
jj =
in.end();
903 if (!
ii->partition_.empty()) {
909 if (
out.find(
ii->partition_) !=
out.end()) {
910 Runs::const_iterator irun =
out[
ii->partition_].begin();
911 Runs::const_iterator jrun =
out[
ii->partition_].end();
912 while (!
found && irun != jrun) {
913 if (irun->number_ ==
ii->number_) {
921 out[
ii->partition_].push_back(*
ii);
954 <<
" NULL pointer to DeviceFactory object!";
Log< level::Info, true > LogVerbatim
DeviceDescriptionsV typedDevices_
std::string passwd() const
static const std::string defaultPartitionName_
std::string outputFecXml() const
DbClient *const databaseCache(std::string method_name="") const
std::string outputModuleXml() const
SiStripConfigDb(const edm::ParameterSet &, const edm::ActivityRegistry &)
std::string outputFedXml() const
std::map< std::string, Runs > RunsByPartition
Log< level::Error, false > LogError
void clearDeviceDescriptions(std::string partition="")
bool checkFileExists(const std::string &path)
const_iterator_range partitions() const
static const char fecSlot_[]
static const char mlConfigDb_[]
static const char ccuChan_[]
static const char ccuAddr_[]
static const char lldChan_[]
SiStripPartitions::const_iterator partition(std::string partition_name) const
void partitions(std::list< std::string > &) const
void clearAnalysisDescriptions(std::string partition="")
static std::atomic< uint32_t > cntr_
static const char fecCrate_[]
std::vector< std::string > partitionNames() const
std::string outputDcuInfoXml() const
Container class for database partition parameters.
std::map< sistrip::RunType, Runs > RunsByType
std::string confdb() const
void clearFedConnections(std::string partition="")
static const char feChan_[]
Container class for database connection parameters.
static const char fecRing_[]
static const uint16_t invalid_
std::string tnsAdmin() const
void handleException(const std::string &method_name, const std::string &extra_info="") const
void usingDatabaseCache()
std::string sharedMemory() const
void pset(const edm::ParameterSet &)
SiStripDbParams dbParams_
static std::atomic< bool > allowCalibUpload_
static const char feUnit_[]
friend class SiStripPartition
void clearDcuDetIds(std::string partition="")
void clearFedDescriptions(std::string partition="")
void addPartition(const SiStripPartition &)
Log< level::Warning, false > LogWarning
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const
static const char null_[]