diff --git a/examples/DDDB/CMakeLists.txt b/examples/DDDB/CMakeLists.txt index 850e1cc39ca11cc0628ebe9d50f16e1d78b00ce5..b0badec308b56105d99086503f9cdfb416f15448 100644 --- a/examples/DDDB/CMakeLists.txt +++ b/examples/DDDB/CMakeLists.txt @@ -189,6 +189,30 @@ if (DD4HEP_USE_XERCESC) REGEX_FAIL "EXCEPTION;Exception" ) # + #---Testing: Load the geometry + conditions + create DeVelo detector elements + dd4hep_add_test_reg( DDDB_DeVelo_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -iov_start 31-12-2000-00:00:00 -iov_end 31-12-2019-00:00:00 + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DeVeloTest -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "TestSummary Total 9110 conditions load summary \\(S:2286,L:4020,C:2804,M:0\\)" + REGEX_FAIL "EXCEPTION" + ) + # + #---Testing: As above, but access conditions using Gaudi-like service + dd4hep_add_test_reg( DDDB_DeVelo_Gaudi_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -iov_start 31-12-2000-00:00:00 -iov_end 31-12-2019-00:00:00 + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DeVeloServiceTest -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "TestSummary Total 10 slices created and accessed during the test." + REGEX_FAIL "EXCEPTION" + ) + # #---Testing: Extract DDDB data from zip archive ------------------------------- dd4hep_add_test_reg( DDDB_clean_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" @@ -206,6 +230,8 @@ if (DD4HEP_USE_XERCESC) DDDB_conditions_dump_simple_LONGTEST DDDB_conditions_LONGTEST DDDB_load_LONGTEST + DDDB_DeVelo_Gaudi_LONGTEST + DDDB_DeVelo_LONGTEST DDDB_extract_LONGTEST REGEX_PASS "DDDB Database successfully removed" ) diff --git a/examples/DDDB/scripts/run_dddb.sh b/examples/DDDB/scripts/run_dddb.sh index 1ed14f98fc212f0a3d0a1abe0c1204ae57678d5c..4b12bd7fff97529e4ef7560177c49af0c102c17c 100755 --- a/examples/DDDB/scripts/run_dddb.sh +++ b/examples/DDDB/scripts/run_dddb.sh @@ -33,6 +33,7 @@ params="-params file:${DDDB_DIR}/Parameters.xml"; input="-input file:${DDDB_DIR}/DDDB/lhcb.xml"; config=""; exec=""; +opts=""; vis=""; debug=""; last_cmd=""; @@ -88,6 +89,14 @@ while [[ "$1" == -* ]]; do input=""; last_cmd=""; ;; + -iov_start) + opts="${opts} -iov_start $2"; + shift; + ;; + -iov_end) + opts="${opts} -iov_end $2"; + shift; + ;; -input) input="-input $2"; last_cmd=""; @@ -124,7 +133,7 @@ if [ "$(uname)" == "Darwin" ]; then export DYLD_LIBRARY_PATH=${DD4HEP_LIBRARY_PATH} fi export DD4HEP_TRACE=ON; -ARGS=`echo -plugin DDDB_Executor ${loader} ${params} ${input} ${config} ${exec} ${vis} ${plugins}`; +ARGS=`echo -plugin DDDB_Executor ${loader} ${params} ${input} ${opts} ${config} ${exec} ${vis} ${plugins}`; echo "Command: ${debug} `which geoPluginRun` -destroy $ARGS"; if test -z "${debug}";then exec `which geoPluginRun` -destroy ${ARGS}; diff --git a/examples/DDDB/src/Detector/DeVPConditionCalls.cpp b/examples/DDDB/src/Detector/DeVPConditionCalls.cpp index 516a7ad0278abba2183734e74cd745a869485fd9..e97482d76a12a55fd5959443706d4bcc3ccdc1bb 100644 --- a/examples/DDDB/src/Detector/DeVPConditionCalls.cpp +++ b/examples/DDDB/src/Detector/DeVPConditionCalls.cpp @@ -96,14 +96,14 @@ void DeVPStaticConditionCall::resolve(Condition c, Context& context) { module->sensors.push_back(sens); support->sensors.push_back(sens); side->sensors.push_back(sens); - printout(INFO,"DeVPStatic","Add Sensor[%03ld]: %s",long(sens->sensorNumber),path.c_str()); + printout(DEBUG,"DeVPStatic","Add Sensor[%03ld]: %s",long(sens->sensorNumber),path.c_str()); break; default: break; } } else { - printout(INFO,"DeVPStatic","Aux.DetElmenet: %s",path.c_str()); + printout(DEBUG,"DeVPStatic","Aux.DetElmenet: %s",path.c_str()); } } } @@ -153,7 +153,7 @@ static void add_generic( detail::DeVPObject* vp, cont.push_back(gen); for ( const auto& j : i->sensors ) gen->sensors.push_back(vp->sensors[j->sensorNumber]); - printout(INFO,"DeVP","Add [%03ld]: %s",cont.size()-1,gen->detector.path().c_str()); + printout(DEBUG,"DeVP","Add [%03ld]: %s",cont.size()-1,gen->detector.path().c_str()); } } @@ -170,7 +170,7 @@ void DeVPConditionCall::resolve(Condition cond, Context& context) { KeyMaker key(i->detector.key(), Keys::deKey); DeVPSensor sens = context.condition(key.hash); vp->sensors[i->sensorNumber] = sens; - printout(INFO,"DeVP","Add Sensor[%03ld]: %s",long(i->sensorNumber),i->detector.path().c_str()); + printout(DEBUG,"DeVP","Add Sensor[%03ld]: %s",long(i->sensorNumber),i->detector.path().c_str()); } } add_generic(vp.ptr(), vp->sides, s->sides, context); diff --git a/examples/DDDB/src/Detector/DeVeloConditionCalls.cpp b/examples/DDDB/src/Detector/DeVeloConditionCalls.cpp index 67093009ab0da25c1767d2150091087f907c1eed..651a4515191c835cb128db1e65fcc86e6376217a 100644 --- a/examples/DDDB/src/Detector/DeVeloConditionCalls.cpp +++ b/examples/DDDB/src/Detector/DeVeloConditionCalls.cpp @@ -60,7 +60,7 @@ void DeVeloStaticConditionCall::resolve(Condition c, Context& context) { bool right = path.find("/VeloRight/Module") != string::npos || path.find("/VeloRight") == path.length()-10; size_t sideNo = left ? DeVeloFlags::LEFT : right ? DeVeloFlags::RIGHT : 99999; - printout(INFO,"DeVelo"," %03d DetElement: %s",i.second, de.path().c_str()); + printout(DEBUG,"DeVelo"," %03d DetElement: %s",i.second, de.path().c_str()); if ( left || right ) { switch( i.second ) { case 0: // Self! @@ -104,14 +104,14 @@ void DeVeloStaticConditionCall::resolve(Condition c, Context& context) { support->sensors.push_back(sens); module->sensors.push_back(sens); side->sensors.push_back(sens); - printout(INFO,"DeVeloStatic","Add Sensor[%03ld]: %s",long(sens->sensorNumber),path.c_str()); + printout(DEBUG,"DeVeloStatic","Add Sensor[%03ld]: %s",long(sens->sensorNumber),path.c_str()); break; default: break; } } else { - printout(INFO,"DeVeloStatic","Aux.DetElmenet: %s",path.c_str()); + printout(DEBUG,"DeVeloStatic","Aux.DetElmenet: %s",path.c_str()); } } } @@ -170,7 +170,7 @@ namespace { for (DeVeloSensorStatic i : src->sensors) { DeVeloSensor sens = mapping[i]; if ( !sens.isValid() ) { - cout << "Problem" << endl; + except("DeVelo","Problem: Invalid sensor refernce encountered."); } gen->sensors.push_back(sens); } @@ -197,9 +197,8 @@ void DeVeloConditionCall::resolve(Condition cond, Context& context) { KeyMaker key(i->detector.key(), Keys::deKey); DeVeloSensor sens = context.condition(key.hash); if ( !sens.isValid() ) { - cout << "Problem Mapping " << (void*)i.ptr() - << " ---> " << (void*)sens.ptr() << " " << i->detector.path() - << endl; + except("DeVelo","Problem Mapping %p ---> %p [%s]", + (void*)i.ptr(), (void*)sens.ptr(), i->detector.path().c_str()); } sensorMapping[i] = sens; continue; diff --git a/examples/DDDB/src/plugins/DDDBExecutor.cpp b/examples/DDDB/src/plugins/DDDBExecutor.cpp index bcbba46c64e0110c691bb0fb50335aea1cf281bc..70c556ecc40b3789a430d845ff68d971270139db 100644 --- a/examples/DDDB/src/plugins/DDDBExecutor.cpp +++ b/examples/DDDB/src/plugins/DDDBExecutor.cpp @@ -111,9 +111,9 @@ static long load_xml_dddb(Detector& description, int argc, char** argv) { break; case 'I': if ( ::strncasecmp(arg+1,"IOV_START",5)==0 ) - iov_start = detail::makeTime(argv[++i]); + iov_start = detail::makeTime(argv[++i],"%d-%m-%Y-%H:%M:%S"); else if ( ::strncasecmp(arg+1,"IOV_END",5)==0 ) - iov_end = detail::makeTime(argv[++i]); + iov_end = detail::makeTime(argv[++i],"%d-%m-%Y-%H:%M:%S"); else sys_id = argv[++i]; last = 0; diff --git a/examples/DDDB/src/plugins/DeVeloServiceTest.cpp b/examples/DDDB/src/plugins/DeVeloServiceTest.cpp index 50a8ca37c87ae534ca04fcf51421c753aa0a6623..36a3e1bb92588bc941b9d8bebd6c2b9557fc0c90 100644 --- a/examples/DDDB/src/plugins/DeVeloServiceTest.cpp +++ b/examples/DDDB/src/plugins/DeVeloServiceTest.cpp @@ -166,18 +166,20 @@ namespace { /// __________________________________________________________________________________ long dump() { + size_t num_round = 10; + long daq_start = dd4hep::detail::makeTime(2016,5,20,0,0,0); shared_ptr<dd4hep::cond::ConditionsSlice> slice; const IDetService::IOVType* iov_typ = m_service->iovType("epoch"); printout(INFO,"ConditionsManager","+++ Starting conditions dump loop"); - for(size_t i=0; i<10; ++i) { - long stamp = dd4hep::detail::makeTime(2016,5,20,i,30,0); - dd4hep::IOV iov(iov_typ, stamp); - configReader(stamp-1800, stamp+1799); // Run duration 1 hour - 1 second + for(size_t i=0; i<num_round; ++i) { + long event_stamp = daq_start + (i*3600) + 1800; + dd4hep::IOV iov(iov_typ, event_stamp); + configReader(event_stamp-1800, event_stamp+1799); // Run duration 1 hour - 1 second // Reset context. Need at some point a better mechanism m_context->alignments_done = dd4hep::Condition(); /// The next line is what would show up in the client code: - slice = m_service->project("DDDB", m_context.get(), "epoch", stamp); + slice = m_service->project("DDDB", m_context.get(), "epoch", event_stamp); printout(INFO,"ConditionsManager","+++ Prepared slice Round: %ld for IOV:%s", i, slice->iov().str().c_str()); @@ -201,6 +203,9 @@ namespace { } } m_service->cleanup(dd4hep::cond::ConditionsFullCleanup()); + printout(dd4hep::ALWAYS,"TestSummary", + "Total %ld slices created and accessed during the test.", num_round); + printout(dd4hep::ALWAYS,"ServiceTest","Test finished...."); return 1; } diff --git a/examples/DDDB/src/plugins/DeVeloTest.cpp b/examples/DDDB/src/plugins/DeVeloTest.cpp index 2514cb3fce41b42edd0d8e905e4488cc717ef861..3a7cac145ebe36a3f51089da6b0af44ad823300b 100644 --- a/examples/DDDB/src/plugins/DeVeloTest.cpp +++ b/examples/DDDB/src/plugins/DeVeloTest.cpp @@ -164,14 +164,14 @@ namespace { long dump() { shared_ptr<dd4hep::cond::ConditionsSlice> slice; dd4hep::cond::ConditionsIOVPool* iovp = m_manager.iovPool(*m_iovtype); - + dd4hep::cond::ConditionsManager::Result total; printout(INFO,"ConditionsManager","+++ Dump pools at dump:"); for(const auto& e : iovp->elements) e.second->print(); printout(INFO,"ConditionsManager","+++ Starting conditions dump loop"); - long start_time = dd4hep::detail::makeTime(2016,5,20,0,0,0); + long daq_start = dd4hep::detail::makeTime(2016,5,20,0,0,0); for(size_t i=0; i<10; ++i) { - long stamp = start_time + i*3600 + 1800; // Middle of 1 hour run + long stamp = daq_start + i*3600 + 1800; // Middle of 1 hour run dd4hep::IOV iov(m_iovtype, stamp); configReader(stamp-1800, stamp+1799); // Run duration 1 hour - 1 second slice.reset(new dd4hep::cond::ConditionsSlice(m_manager, m_content)); @@ -179,6 +179,7 @@ namespace { dd4hep::cond::ConditionsManager::Result res = m_manager.prepare(iov, *slice, m_context.get()); printout(dd4hep::ALWAYS,"ConditionsManager","Total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) of IOV %s", res.total(), res.selected, res.loaded, res.computed, res.missing, iov.str().c_str()); + total += res; for(const auto& e : iovp->elements) e.second->print(); DeVelo devp = slice->get(m_de,Keys::deKey); @@ -202,6 +203,8 @@ namespace { } } m_manager.clean(dd4hep::cond::ConditionsFullCleanup()); + printout(dd4hep::ALWAYS,"TestSummary","Total %ld conditions load summary (S:%ld,L:%ld,C:%ld,M:%ld)", + total.total(), total.selected, total.loaded, total.computed, total.missing); printout(dd4hep::ALWAYS,"ServiceTest","Test finished...."); return 1; }