File indexing completed on 2025-01-31 09:20:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "Detector/DetectorElement_inl.h"
0018 #include "DD4hep/Printout.h"
0019 #include "DDDB/DDDBConversion.h"
0020 #include "DD4hep/ConditionsDebug.h"
0021
0022 namespace gaudi {
0023 template std::map<dd4hep::DetElement, gaudi::detail::DeStaticObject*>
0024 DeHelpers::getChildConditions<gaudi::detail::DeStaticObject>(ConditionsMap& m, DetElement de, itemkey_type key, int flags);
0025 }
0026
0027 using namespace gaudi;
0028 using namespace gaudi::detail;
0029
0030
0031 DeStaticObject* DeStaticObject::fill_info(DetElement de, Catalog* cat) {
0032 #if !defined(DD4HEP_MINIMAL_CONDITIONS)
0033 name = Keys::staticKeyName;
0034 #endif
0035 detector = de;
0036 geometry = de.placement();
0037 key = Keys::staticKey;
0038 clsID = cat->classID;
0039 catalog = cat;
0040 for( const auto& p : cat->params )
0041 parameters.set(p.first, p.second.second, p.second.first);
0042 return this;
0043 }
0044
0045
0046 void DeStaticObject::initialize() {
0047 if ( (de_flags&DeInit::INITIALIZED) == 0 ) {
0048 de_flags |= DeInit::INITIALIZED;
0049 return;
0050 }
0051 except("DeStatic","initialize> Modifying a condition after initialization is not allowed!");
0052 }
0053
0054
0055 void DeStaticObject::print(int indent, int flg) const {
0056 std::string prefix = DE::indent(indent);
0057 printout(INFO, "DeStatic", "%s*========== Detector:%s",
0058 prefix.c_str(), detector.path().c_str());
0059 if ( flg & DePrint::PARAMS ) {
0060 for( const auto& p : parameters.params() ) {
0061 printout(INFO, "DeStatic", "%s+ Param: %s -> %s [%s]",
0062 prefix.c_str(), p.first.c_str(),
0063 p.second.value.c_str(), p.second.type.c_str());
0064 }
0065 }
0066 printout(INFO, "DeStatic",
0067 "%s+ Name:%s Hash:%016lX Type:%s Flags:%08X %s%s",
0068 prefix.c_str(), dd4hep::cond::cond_name(this).c_str(), hash,
0069 is_bound() ? data.dataType().c_str() : "<UNBOUND>",
0070 flags, iov ? "" : "IOV:", iov ? "" : "---");
0071 if ( iov ) {
0072 printout(INFO, "DeStatic","%s+ IOV: %s", prefix.c_str(), iov->str().c_str());
0073 }
0074 if ( flg & DePrint::BASICS ) {
0075 const DetElement::Children& c = detector.children();
0076 printout(INFO, "DeStatic", "%s+ Detector:%s Class:%d key:%08X #Dau:%d",
0077 prefix.c_str(), detector.name(), clsID, key, int(c.size()));
0078 }
0079 }
0080
0081
0082 DeStaticObject* DeStaticObject::child(DetElement de) const {
0083 auto i = childCache.find(de);
0084 if ( i == childCache.end() ) {
0085 except("DeStatic","child> No such condition:%s for detector element:%s",
0086 Keys::staticKeyName.c_str(), de.path().c_str());
0087 }
0088 return (*i).second;
0089 }
0090
0091
0092 void DeStaticObject::fillCache(ConditionsMap& m) {
0093 if ( (de_flags&DeInit::INITIALIZED) == 0 ) {
0094 childCache = DeHelpers::getChildConditions<DeStaticObject>(m, detector,Keys::deKey, DeHelpers::ALL);
0095 return;
0096 }
0097 except("DeIov","fillCache> Modifying % (%s) after initialization is not allowed!",
0098 Keys::staticKeyName.c_str(), detector.path().c_str());
0099 }
0100
0101
0102 const ParameterMap::Parameters& DeStaticObject::params() const {
0103 return this->parameters.params();
0104 }
0105
0106
0107 const ParameterMap::Parameter&
0108 DeStaticObject::parameter(const std::string& nam, bool throw_if_not_present) const {
0109 return this->parameters.parameter(nam, throw_if_not_present);
0110 }