$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include "otsdaq-core/SupervisorInfo/SupervisorDescriptorInfoBase.h" 00002 00003 #include <xdaq/ContextDescriptor.h> 00004 #include "otsdaq-core/MessageFacility/MessageFacility.h" 00005 00006 #include <cassert> 00007 00008 using namespace ots; 00009 00010 //======================================================================================================================== 00011 SupervisorDescriptorInfoBase::SupervisorDescriptorInfoBase(void) {} 00012 00013 //======================================================================================================================== 00014 SupervisorDescriptorInfoBase::SupervisorDescriptorInfoBase( 00015 xdaq::ApplicationContext* applicationContext) 00016 { 00017 init(applicationContext); 00018 } 00019 00020 //======================================================================================================================== 00021 SupervisorDescriptorInfoBase::~SupervisorDescriptorInfoBase() {} 00022 00023 //======================================================================================================================== 00024 void SupervisorDescriptorInfoBase::destroy() { allSupervisors_.clear(); } 00025 00026 //======================================================================================================================== 00027 void SupervisorDescriptorInfoBase::init(xdaq::ApplicationContext* applicationContext) 00028 { 00029 if(applicationContext->getDefaultZone()->getApplicationGroup("daq") == 0) 00030 { 00031 __SS__ << "Could not find xdaq application group \"daq\" (Must not be present in " 00032 "the xdaq context configuration)" 00033 << __E__; 00034 __SS_THROW__; 00035 } 00036 00037 __COUT__ << "Init" << __E__; 00038 00039 // //There is only one and only Supervisor! (Or Config Wizard!!) 00040 // theSupervisor_ = 00041 //*(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::Supervisor").begin()); 00042 // if(0)//theSupervisor_ == 0) 00043 // __COUT__ << "Note: Could not find xdaq application descriptor 00044 //\"ots::Supervisor\" (Must not be present in the xdaq context configuration)" << 00045 //__E__; 00046 // 00047 // theWizard_ = 00048 //*(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::OtsConfigurationWizardSupervisor").begin()); 00049 // if(0)//theWizard_ == 0) 00050 // __COUT__ << "Note: Could not find xdaq application descriptor 00051 //\"ots::OtsConfigurationWizardSupervisor\" (Must not be present in the xdaq context 00052 // configuration)" << __E__; 00053 // 00054 // if(theWizard_ == 0 && theSupervisor_ == 0) 00055 // { 00056 // __SS__ << "Must have THE ots::Supervisor (or THE 00057 // ots::OtsConfigurationWizardSupervisor) as part of the context configuration!" << 00058 //__E__; 00059 // __COUT_ERR__ << "\n" << ss.str(); 00060 // __SS_THROW__; 00061 // } 00062 00063 std::set<XDAQ_CONST_CALL xdaq::ApplicationDescriptor*> appDescriptors; 00064 00065 // get allSupervisors_ 00066 00067 // allFETypeSupervisors_.clear(); 00068 allSupervisors_.clear(); 00069 appDescriptors = applicationContext->getDefaultZone() 00070 ->getApplicationGroup("daq") 00071 ->getApplicationDescriptors(); 00072 for(auto& it : appDescriptors) 00073 { 00074 auto /*<it,bool*/ retPair = allSupervisors_.emplace( 00075 std::pair<xdata::UnsignedIntegerT, 00076 XDAQ_CONST_CALL xdaq::ApplicationDescriptor*>(it->getLocalId(), 00077 it)); 00078 if(!retPair.second) 00079 { 00080 __SS__ << "Error! Duplicate Application IDs are not allowed. ID =" 00081 << it->getLocalId() << __E__; 00082 __SS_THROW__; 00083 } 00084 } 00085 00086 // 00087 // theLogbookSupervisor_ = 00088 //*(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::LogbookSupervisor").begin()); 00089 // if(theWizard_ == 0 && theLogbookSupervisor_ == 0) 00090 // __COUT__ << "Note: Could not find xdaq application descriptor 00091 //\"ots::LogbookSupervisor\" (Must not be present in the xdaq context configuration)" 00092 //<< __E__; 00093 00094 // theDataManagerSupervisors_.clear(); 00095 // appDescriptors = 00096 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::DataManagerSupervisor"); 00097 // for(auto& it: appDescriptors) 00098 // theDataManagerSupervisors_[it->getLocalId()] = it; 00099 // if(theWizard_ == 0 && theDataManagerSupervisors_.size() == 0) 00100 // __COUT__ << "Note: Could not find any xdaq application descriptor 00101 //\"ots::DataManagerSupervisor\" (Must not be present in the xdaq context 00102 // configuration)" << __E__; 00103 00104 // //theFESupervisors_.clear(); 00105 // appDescriptors = 00106 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FESupervisor"); 00107 // for(auto& it: appDescriptors) 00108 // { 00109 // //theFESupervisors_[it->getLocalId()] = it; 00110 // allFETypeSupervisors_[it->getLocalId()] = it; 00111 // } 00112 00113 // if(theWizard_ == 0 && theFESupervisors_.size() == 0) 00114 // __COUT__ << "Note: Could not find any xdaq application descriptor 00115 //\"ots::FESupervisor\" (Must not be present in the xdaq context configuration)" << 00116 //__E__; 00117 00118 // RAR: no need for this theDTCSupervisors_.. state machine should use 'all 00119 // supervisors' 00120 // theDTCSupervisors_.clear(); 00121 // appDescriptors = 00122 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("Ph2TkDAQ::DTCSupervisor"); 00123 // for(auto& it: appDescriptors) 00124 // theDTCSupervisors_[it->getLocalId()] = it; 00126 // if(theDTCSupervisors_.size() == 0) 00127 // { 00128 // __COUT__ << "Note: Could not find any xdaq application descriptor 00129 // \"ots::DTCSupervisor\" (Must not be present in the xdaq context 00130 // configuration)" << __E__; 00131 // //assert(0); 00132 // } 00133 00134 // theFEDataManagerSupervisors_.clear(); 00135 // appDescriptors = 00136 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FEDataManagerSupervisor"); 00137 // for(auto& it: appDescriptors) 00138 // { 00139 // //theFEDataManagerSupervisors_[it->getLocalId()] = it; 00140 // allFETypeSupervisors_[it->getLocalId()] = it; 00141 // } 00142 // if(theWizard_ == 0 && theFEDataManagerSupervisors_.size() == 0) 00143 // __COUT__ << "Note: Could not find any xdaq application descriptor 00144 //\"ots::FEDataManagerSupervisor\" (Must not be present in the xdaq context 00145 // configuration)" << __E__; 00146 00147 // theARTDAQFESupervisors_.clear(); 00148 // for(auto& it: 00149 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFESupervisor")) 00150 // theARTDAQFESupervisors_[it->getLocalId()] = it; 00151 // if(theARTDAQFESupervisors_.size() == 0) 00152 // { 00153 // __COUT__ << "Note: Could not find xdaq application descriptor 00154 // \"ots::ARTDAQFESupervisor\" (Must not be present in the xdaq context 00155 // configuration)" << __E__; 00156 // //assert(0); 00157 // } 00158 // 00159 // theARTDAQFEDataManagerSupervisors_.clear(); 00160 // for(auto& it: 00161 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFEDataManagerSupervisor")) 00162 // { 00163 // //theARTDAQFEDataManagerSupervisors_[it->getLocalId()] = it; 00164 // allFETypeSupervisors_[it->getLocalId()] = it; 00165 // } 00166 // if(0)//theARTDAQFEDataManagerSupervisors_.size() == 0) 00167 // __COUT__ << "Note: Could not find any xdaq application descriptor 00168 //\"ots::ARTDAQFEDataManagerSupervisor\" (Must not be present in the xdaq context 00169 // configuration)" << __E__; 00170 // 00171 // theARTDAQDataManagerSupervisors_.clear(); 00172 // for(auto& it: 00173 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQDataManagerSupervisor")) 00174 // theARTDAQDataManagerSupervisors_[it->getLocalId()] = it; 00175 // if(0)//theARTDAQDataManagerSupervisors_.size() == 0) 00176 // __COUT__ << "Note: Could not find any xdaq application descriptor 00177 //\"ots::ARTDAQDataManagerSupervisor\" (Must not be present in the xdaq context 00178 // configuration)" << __E__; 00179 // 00180 // 00181 // theARTDAQBuilderSupervisors_.clear(); 00182 // for(auto& it: 00183 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::EventBuilderApp")) 00184 // theARTDAQBuilderSupervisors_[it->getLocalId()] = it; 00185 // if(0)//theARTDAQBuilderSupervisors_.size() == 0) 00186 // __COUT__ << "Note: Could not find any xdaq application descriptor 00187 //\"ots::EventBuilderApp\" (Must not be present in the xdaq context configuration)" << 00188 //__E__; 00189 // 00190 // 00191 // theARTDAQAggregatorSupervisors_.clear(); 00192 // for(auto& it: 00193 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::AggregatorApp")) 00194 // theARTDAQAggregatorSupervisors_[it->getLocalId()] = it; 00195 // if(0)//theARTDAQAggregatorSupervisors_.size() == 0) 00196 // __COUT__ << "Note: Could not find any xdaq application descriptor 00197 //\"ots::AggregatorApp\" (Must not be present in the xdaq context configuration)" << 00198 //__E__; 00199 // 00200 // 00201 // theVisualSupervisors_.clear(); 00202 // for(auto& it: 00203 // applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::VisualSupervisor")) 00204 // theVisualSupervisors_[it->getLocalId()] = it; 00205 // if(0)//theVisualSupervisors_.size() == 0) 00206 // __COUT__ << "Note: Could not find any xdaq application descriptor 00207 //\"ots::VisualSupervisor\" (Must not be present in the xdaq context configuration)" 00208 //<< __E__; 00209 } 00210 00211 // 00213 // const SupervisorDescriptors& 00214 // SupervisorDescriptorInfoBase::getDataManagerDescriptors(void) const 00215 //{ 00216 // return theDataManagerSupervisors_; 00217 //} 00218 // 00220 // const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDescriptors(void) const 00221 //{ 00222 // return theFESupervisors_; 00223 //} 00224 // 00226 // const SupervisorDescriptors& SupervisorDescriptorInfoBase::getDTCDescriptors(void) 00227 // const 00228 //{ 00229 // return theDTCSupervisors_; 00230 //} 00231 // 00233 // const SupervisorDescriptors& 00234 // SupervisorDescriptorInfoBase::getFEDataManagerDescriptors(void) const 00235 //{ 00236 // return theFEDataManagerSupervisors_; 00237 //} 00238 00239 //======================================================================================================================== 00240 // const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQFEDescriptors(void) 00241 // const 00242 //{ 00243 // return theARTDAQFESupervisors_; 00244 //} 00246 // const SupervisorDescriptors& 00247 // SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptors(void) const 00248 //{ 00249 // return theARTDAQFEDataManagerSupervisors_; 00250 //} 00252 // const SupervisorDescriptors& 00253 // SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptors (void) const 00254 //{ 00255 // return theARTDAQDataManagerSupervisors_; 00256 //} 00257 // 00259 // const SupervisorDescriptors& 00260 // SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptors(void) const 00261 //{ 00262 // return theARTDAQBuilderSupervisors_; 00263 //} 00264 // 00266 // const SupervisorDescriptors& 00267 // SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptors(void) const 00268 //{ 00269 // return theARTDAQAggregatorSupervisors_; 00270 //} 00271 // 00273 // const SupervisorDescriptors& SupervisorDescriptorInfoBase::getVisualDescriptors(void) 00274 // const 00275 //{ 00276 // return theVisualSupervisors_; 00277 //} 00278 00279 //======================================================================================================================== 00280 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getAllDescriptors(void) const 00281 { 00282 return allSupervisors_; 00283 } 00284 // 00286 // const SupervisorDescriptors& SupervisorDescriptorInfoBase::getAllFEDescriptors(void) 00287 // const 00288 //{ 00289 // return allFETypeSupervisors_; 00290 //} 00291 // 00293 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00294 // SupervisorDescriptorInfoBase::getSupervisorDescriptor(void) const 00295 //{ 00296 // return theSupervisor_; 00297 //} 00298 // 00300 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00301 // SupervisorDescriptorInfoBase::getWizardDescriptor(void) const 00302 //{ 00303 // return theWizard_; 00304 //} 00305 // 00307 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00308 // SupervisorDescriptorInfoBase::getLogbookDescriptor(void) const 00309 //{ 00310 // return theLogbookSupervisor_; 00311 //} 00312 // 00314 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00315 // SupervisorDescriptorInfoBase::getVisualDescriptor(xdata::UnsignedIntegerT instance) 00316 // const 00317 //{ 00318 // if(theVisualSupervisors_.find(instance) == theVisualSupervisors_.end()) 00319 // __COUT__ << "Could not find: " << instance << __E__; 00320 // return theVisualSupervisors_.find(instance)->second; 00321 //} 00322 // 00324 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00325 // SupervisorDescriptorInfoBase::getDataManagerDescriptor(xdata::UnsignedIntegerT 00326 // instance) const 00327 //{ 00328 // if(theDataManagerSupervisors_.find(instance) == theDataManagerSupervisors_.end()) 00329 // __COUT__ << "Could not find: " << instance << __E__; 00330 // return theDataManagerSupervisors_.find(instance)->second; 00331 //} 00332 // 00334 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00335 // SupervisorDescriptorInfoBase::getFEDescriptor(xdata::UnsignedIntegerT instance) const 00336 //{ 00337 // if(theFESupervisors_.find(instance) == theFESupervisors_.end()) 00338 // __COUT__ << "Could not find: " << instance << __E__; 00339 // return theFESupervisors_.find(instance)->second; 00340 //} 00341 // 00343 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00344 // SupervisorDescriptorInfoBase::getDTCDescriptor(xdata::UnsignedIntegerT instance) const 00345 //{ 00346 // if(theDTCSupervisors_.find(instance) == theDTCSupervisors_.end()) 00347 // __COUT__ << "Could not find: " << instance << __E__; 00348 // return theDTCSupervisors_.find(instance)->second; 00349 //} 00350 // 00352 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00353 // SupervisorDescriptorInfoBase::getFEDataManagerDescriptor(xdata::UnsignedIntegerT 00354 // instance) const 00355 //{ 00356 // if(theFEDataManagerSupervisors_.find(instance) == theFEDataManagerSupervisors_.end()) 00357 // __COUT__ << "Could not find: " << instance << __E__; 00358 // return theFEDataManagerSupervisors_.find(instance)->second; 00359 //} 00360 00361 //======================================================================================================================== 00362 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00363 // SupervisorDescriptorInfoBase::getARTDAQFEDescriptor(xdata::UnsignedIntegerT instance) 00364 // const 00365 //{ 00366 // if(theARTDAQFESupervisors_.find(instance) == theARTDAQFESupervisors_.end()) 00367 // __COUT__ << "Could not find: " << instance << __E__; 00368 // return theARTDAQFESupervisors_.find(instance)->second; 00369 //} 00370 // 00372 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00373 // SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptor(xdata::UnsignedIntegerT 00374 // instance) const 00375 //{ 00376 // if(theARTDAQFEDataManagerSupervisors_.find(instance) == 00377 // theARTDAQFEDataManagerSupervisors_.end()) 00378 // __COUT__ << "Could not find: " << instance << __E__; 00379 // return theARTDAQFEDataManagerSupervisors_.find(instance)->second; 00380 //} 00381 // 00383 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00384 // SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptor (xdata::UnsignedIntegerT 00385 // instance) const 00386 //{ 00387 // if(theARTDAQDataManagerSupervisors_.find(instance) == 00388 // theARTDAQDataManagerSupervisors_.end()) 00389 // __COUT__ << "Could not find: " << instance << __E__; 00390 // return theARTDAQDataManagerSupervisors_.find(instance)->second; 00391 //} 00392 // 00394 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00395 // SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptor(xdata::UnsignedIntegerT 00396 // instance) const 00397 //{ 00398 // if(theARTDAQBuilderSupervisors_.find(instance) == theARTDAQBuilderSupervisors_.end()) 00399 // __COUT__ << "Could not find: " << instance << __E__; 00400 // return theARTDAQBuilderSupervisors_.find(instance)->second; 00401 //} 00402 // 00404 // XDAQ_CONST_CALL xdaq::ApplicationDescriptor* 00405 // SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptor(xdata::UnsignedIntegerT 00406 // instance) const 00407 //{ 00408 // if(theARTDAQAggregatorSupervisors_.find(instance) == 00409 // theARTDAQAggregatorSupervisors_.end()) 00410 // __COUT__ << "Could not find: " << instance << __E__; 00411 // return theARTDAQAggregatorSupervisors_.find(instance)->second; 00412 //} 00413 // 00415 // std::string SupervisorDescriptorInfoBase::getFEURL(xdata::UnsignedIntegerT instance) 00416 // const 00417 //{ 00418 // if(allFETypeSupervisors_.find(instance) == allFETypeSupervisors_.end()) 00419 // __COUT__ << "Could not find: " << instance << __E__; 00420 // return allFETypeSupervisors_.find(instance)->second->getContextDescriptor()->getURL(); 00421 // //getFEDescriptor(instance)->getContextDescriptor()->getURL(); 00422 //} 00423 00424 /* 00425 //======================================================================================================================== 00426 std::string SupervisorDescriptorInfoBase::getARTDAQFEURL(xdata::UnsignedIntegerT instance) 00427 const 00428 { 00429 return getARTDAQFEDescriptor(instance)->getContextDescriptor()->getURL(); 00430 } 00431 00432 //======================================================================================================================== 00433 std::string SupervisorDescriptorInfoBase::getARTDAQBuilderURL(xdata::UnsignedIntegerT 00434 instance) const 00435 { 00436 return getARTDAQBuilderDescriptor(instance)->getContextDescriptor()->getURL(); 00437 } 00438 00439 //======================================================================================================================== 00440 std::string SupervisorDescriptorInfoBase::getARTDAQAggregatorURL(xdata::UnsignedIntegerT 00441 instance) const 00442 { 00443 return getARTDAQAggregatorDescriptor(instance)->getContextDescriptor()->getURL(); 00444 } 00445 */