Skip to content
Snippets Groups Projects

changes for running online

Merged Rosen Matev requested to merge rm-align-online into master
All threads resolved!
1 file
+ 44
0
Compare changes
  • Side-by-side
  • Inline
@@ -41,6 +41,7 @@
#include "GaudiKernel/IUpdateable.h"
#include "GaudiKernel/Service.h"
#include "GaudiKernel/SmartIF.h"
#include <GaudiKernel/IPublishSvc.h>
#include "TH1D.h"
@@ -134,6 +135,7 @@ namespace LHCb::Alignment {
/// the execution of the algorithm
SmartIF<IIncidentSvc> m_incidentSvc;
SmartIF<IDataProviderSvc> m_detectorSvc;
SmartIF<IPublishSvc> m_publishSvc;
/// Its initialization
StatusCode initialize() override;
StatusCode stop() override;
@@ -165,6 +167,14 @@ namespace LHCb::Alignment {
"directory where to write the overlay content "};
Gaudi::Property<std::vector<std::string>> m_elemsToBeAligned{this, "Elements", {}, "Path to elements"};
Gaudi::Property<std::vector<std::string>> m_derivativeFiles{this, "DerivativeFiles", {}, "List of paths"};
Gaudi::Property<std::string> m_runType{this, "RunType", "NotDefined",
"run type (VELO, SciFi, ...)"};
Gaudi::Property<std::string> m_ServInfix{this, "ServiceInfix", "TrackerAlignment/",
"prefix to Conditions PublishSvc"};
Gaudi::Property<std::vector<std::string>> m_subDets{this, "SubDetectors", {"VELO"},
"sub-detectors used"};
private:
std::thread* m_thread = nullptr;
@@ -172,6 +182,8 @@ namespace LHCb::Alignment {
StatusCode m_status = StatusCode::SUCCESS;
std::map<std::string, double> m_initAlConsts; // inital alignment constants. Comapred with constants after
// convergence to see if update is needed
std::string m_align_message; // < string with error messages or info to publish with DIM service
std::map<std::string, std::string*> m_condmap;
#ifdef USE_DD4HEP
ServiceHandle<LHCb::Det::LbDD4hep::IDD4hepSvc> m_dd4hepSvc{this, "DD4hepSvc", "LHCb::Det::LbDD4hep::DD4hepSvc",
@@ -268,10 +280,12 @@ namespace LHCb::Alignment {
cmp.SetVerbosity( true );
cmp.Compare();
info() << "Iteration converged. Stopping" << endmsg;
m_align_message = "INFO: Iterator converged";
m_status = StatusCode::SUCCESS;
doStop();
} else {
info() << "Iteration not converged. Continue" << endmsg;
m_align_message = "INFO: Iterator not converged";
#ifdef USE_DD4HEP
// refresh the overlay from files
@@ -300,15 +314,44 @@ namespace LHCb::Alignment {
error() << "Cannot access incident service of type DetectorDataSvc." << endmsg;
return StatusCode::FAILURE;
}
m_publishSvc = this->service( "LHCb::PublishSvc" );
if ( !this->m_publishSvc.get() ) {
error() << "Cannot access incident service of type PublishSvc." << endmsg;
return StatusCode::FAILURE;
}
this->m_incidentSvc->addListener( this, "DAQ_PAUSED" );
this->m_incidentSvc->addListener( this, "DAQ_CONTINUE" );
// Define error DIM service
m_align_message = "INFO: " + m_runType + " Initializing align messenger"; // This message will be overwritten
m_publishSvc->declarePubItem( "AlignmentMessenger", m_align_message );
m_publishSvc->declarePubItem( "AlignTest", "aligntest" );
std::vector<std::string> condnames;
for ( const auto& sd : m_subDets ) {
condnames.push_back( sd + "/" + sd + "Global" );
condnames.push_back( sd + "/" + sd + "Modules" );
}
for ( const auto& i : condnames ) {
std::string* s = new std::string( "" );
m_condmap.insert( std::make_pair( i, s ) );
//TODO: add xmlcopiers?
// AlignOnlineXMLCopier* acpy = new AlignOnlineXMLCopier( m_onlinexmldir, m_runningxmldir, i, &info() );
m_publishSvc->declarePubItem( m_ServInfix + i, *s );
//m_xmlcopiers.push_back( acpy );
}
return sc;
}
StatusCode AlignOnlineIterator::pause() // the execution of the algorithm
{
info() << "iterator pausing " << m_iteration << endmsg;
m_publishSvc->updateAll();
if ( m_thread != nullptr ) {
m_thread->join();
delete m_thread;
@@ -339,6 +382,7 @@ namespace LHCb::Alignment {
StatusCode AlignOnlineIterator::finalize() {
info() << "iterator finalizing " << endmsg;
m_publishSvc->undeclarePubAll();
this->m_incidentSvc.reset();
return this->Service::finalize();
}
Loading