$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include "otsdaq-core/ConfigurationInterface/ConfigurationManager.h" 00002 #include "otsdaq-core/Macros/TablePluginMacros.h" 00003 #include "otsdaq-core/TablePluginDataFormats/ARTDAQBuilderTable.h" 00004 #include "otsdaq-core/TablePluginDataFormats/XDAQContextTable.h" 00005 00006 #include <stdio.h> 00007 #include <sys/stat.h> //for mkdir 00008 #include <fstream> // std::fstream 00009 #include <iostream> 00010 00011 using namespace ots; 00012 00013 #define ARTDAQ_FCL_PATH std::string(getenv("USER_DATA")) + "/" + "ARTDAQConfigurations/" 00014 #define ARTDAQ_FILE_PREAMBLE "builder" 00015 00016 // helpers 00017 #define OUT out << tabStr << commentStr 00018 #define PUSHTAB tabStr += "\t" 00019 #define POPTAB tabStr.resize(tabStr.size() - 1) 00020 #define PUSHCOMMENT commentStr += "# " 00021 #define POPCOMMENT commentStr.resize(commentStr.size() - 2) 00022 00023 //======================================================================================================================== 00024 ARTDAQBuilderTable::ARTDAQBuilderTable(void) : TableBase("ARTDAQBuilderTable") 00025 { 00027 // WARNING: the names used in C++ MUST match the Table INFO // 00029 } 00030 00031 //======================================================================================================================== 00032 ARTDAQBuilderTable::~ARTDAQBuilderTable(void) {} 00033 00034 //======================================================================================================================== 00035 void ARTDAQBuilderTable::init(ConfigurationManager* configManager) 00036 { 00037 // make directory just in case 00038 mkdir((ARTDAQ_FCL_PATH).c_str(), 0755); 00039 00040 __COUT__ << "*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << __E__; 00041 __COUT__ << configManager->__SELF_NODE__ << __E__; 00042 00043 const XDAQContextTable* contextConfig = 00044 configManager->__GET_CONFIG__(XDAQContextTable); 00045 00046 std::vector<const XDAQContextTable::XDAQContext*> builderContexts = 00047 contextConfig->getEventBuilderContexts(); 00048 00049 // for each aggregator context 00050 // output associated fcl config file 00051 for(auto& builderContext : builderContexts) 00052 { 00053 ConfigurationTree builderAppNode = contextConfig->getApplicationNode( 00054 configManager, 00055 builderContext->contextUID_, 00056 builderContext->applications_[0].applicationUID_); 00057 ConfigurationTree builderConfigNode = contextConfig->getSupervisorConfigNode( 00058 configManager, 00059 builderContext->contextUID_, 00060 builderContext->applications_[0].applicationUID_); 00061 00062 __COUT__ << "Path for this aggregator config is " << builderContext->contextUID_ 00063 << "/" << builderContext->applications_[0].applicationUID_ << "/" 00064 << builderConfigNode.getValueAsString() << __E__; 00065 00066 outputFHICL( 00067 configManager, 00068 builderConfigNode, 00069 contextConfig->getARTDAQAppRank(builderContext->contextUID_), 00070 contextConfig->getContextAddress(builderContext->contextUID_), 00071 contextConfig->getARTDAQDataPort(configManager, builderContext->contextUID_), 00072 contextConfig); 00073 } 00074 } 00075 00076 //======================================================================================================================== 00077 std::string ARTDAQBuilderTable::getFHICLFilename(const ConfigurationTree& builderNode) 00078 { 00079 __COUT__ << "ARTDAQ Builder UID: " << builderNode.getValue() << __E__; 00080 std::string filename = ARTDAQ_FCL_PATH + ARTDAQ_FILE_PREAMBLE + "-"; 00081 std::string uid = builderNode.getValue(); 00082 for(unsigned int i = 0; i < uid.size(); ++i) 00083 if((uid[i] >= 'a' && uid[i] <= 'z') || (uid[i] >= 'A' && uid[i] <= 'Z') || 00084 (uid[i] >= '0' && uid[i] <= '9')) // only allow alpha numeric in file name 00085 filename += uid[i]; 00086 00087 filename += ".fcl"; 00088 00089 __COUT__ << "fcl: " << filename << __E__; 00090 00091 return filename; 00092 } 00093 00094 //======================================================================================================================== 00095 void ARTDAQBuilderTable::outputFHICL(ConfigurationManager* configManager, 00096 const ConfigurationTree& builderNode, 00097 unsigned int selfRank, 00098 std::string selfHost, 00099 unsigned int selfPort, 00100 const XDAQContextTable* contextConfig) 00101 { 00102 /* 00103 the file will look something like this: 00104 00105 services: { 00106 scheduler: { 00107 fileMode: NOMERGE 00108 errorOnFailureToPut: false 00109 } 00110 NetMonTransportServiceInterface: { 00111 service_provider: NetMonTransportService 00112 #broadcast_sends: true 00113 destinations: { 00114 d4: { transferPluginType: MPI destination_rank: 4 max_fragment_size_bytes: 00115 2097152} 00116 00117 } 00118 } 00119 00120 #SimpleMemoryCheck: { } 00121 } 00122 00123 daq: { 00124 event_builder: { 00125 expected_fragments_per_event: 2 00126 use_art: true 00127 print_event_store_stats: true 00128 verbose: false 00129 send_requests: true 00130 request_port: 00131 request_address: 00132 00133 sources: { 00134 s0: { transferPluginType: MPI source_rank: 0 max_fragment_size_bytes: 00135 2097152} s1: { transferPluginType: MPI source_rank: 1 max_fragment_size_bytes: 00136 2097152} 00137 00138 } 00139 } 00140 metrics: { 00141 evbFile: { 00142 metricPluginType: "file" 00143 level: 3 00144 fileName: "/tmp/eventbuilder/evb_%UID%_metrics.log" 00145 uniquify: true 00146 } 00147 # ganglia: { 00148 # metricPluginType: "ganglia" 00149 # level: %{ganglia_level} 00150 # reporting_interval: 15.0 00151 # 00152 # configFile: "/etc/ganglia/gmond.conf" 00153 # group: "ARTDAQ" 00154 # } 00155 # msgfac: { 00156 # level: %{mf_level} 00157 # metricPluginType: "msgFacility" 00158 # output_message_application_name: "ARTDAQ Metric" 00159 # output_message_severity: 0 00160 # } 00161 # graphite: { 00162 # level: %{graphite_level} 00163 # metricPluginType: "graphite" 00164 # host: "localhost" 00165 # port: 20030 00166 # namespace: "artdaq." 00167 # } 00168 } 00169 } 00170 00171 outputs: { 00172 rootMPIOutput: { 00173 module_type: RootMPIOutput 00174 #SelectEvents: { SelectEvents: [ pmod2,pmod3 ] } 00175 } 00176 #normalOutput: { 00177 # module_type: RootOutput 00178 # fileName: "/tmp/artdaqdemo_eb00_r%06r_sr%02s_%to.root" 00179 # #SelectEvents: { SelectEvents: [ pmod2,pmod3 ] } 00180 #} 00181 } 00182 00183 physics: { 00184 analyzers: { 00185 00186 } 00187 00188 producers: { 00189 } 00190 00191 filters: { 00192 00193 prescaleMod2: { 00194 module_type: NthEvent 00195 nth: 2 00196 } 00197 00198 prescaleMod3: { 00199 module_type: NthEvent 00200 nth: 3 00201 } 00202 } 00203 00204 pmod2: [ prescaleMod2 ] 00205 pmod3: [ prescaleMod3 ] 00206 00207 00208 #a1: [ app, wf ] 00209 00210 my_output_modules: [ rootMPIOutput ] 00211 #my_output_modules: [ normalOutput ] 00212 } 00213 source: { 00214 module_type: DemoInput 00215 waiting_time: 2500000 00216 resume_after_timeout: true 00217 } 00218 process_name: DAQ 00219 00220 */ 00221 00222 std::string filename = getFHICLFilename(builderNode); 00223 00225 // generate xdaq run parameter file 00226 std::fstream out; 00227 00228 std::string tabStr = ""; 00229 std::string commentStr = ""; 00230 00231 out.open(filename, std::fstream::out | std::fstream::trunc); 00232 if(out.fail()) 00233 { 00234 __SS__ << "Failed to open ARTDAQ Builder fcl file: " << filename << __E__; 00235 __SS_THROW__; 00236 } 00237 00238 //-------------------------------------- 00239 // header 00240 OUT << "###########################################################" << __E__; 00241 OUT << "#" << __E__; 00242 OUT << "# artdaq builder fcl configuration file produced by otsdaq." << __E__; 00243 OUT << "# Creation timestamp: " << StringMacros::getTimestampString() << __E__; 00244 OUT << "# Original filename: " << filename << __E__; 00245 OUT << "# otsdaq-ARTDAQ Builder UID: " << builderNode.getValue() << __E__; 00246 OUT << "#" << __E__; 00247 OUT << "###########################################################" << __E__; 00248 OUT << "\n\n"; 00249 00250 // no primary link to table tree for reader node! 00251 if(builderNode.isDisconnected()) 00252 { 00253 // create empty fcl 00254 OUT << "{}\n\n"; 00255 out.close(); 00256 return; 00257 } 00258 00259 //-------------------------------------- 00260 // handle services 00261 auto services = builderNode.getNode("servicesLink"); 00262 if(!services.isDisconnected()) 00263 { 00264 OUT << "services: {\n"; 00265 00266 // scheduler 00267 PUSHTAB; 00268 OUT << "scheduler: {\n"; 00269 00270 PUSHTAB; 00271 OUT << "fileMode: " << services.getNode("schedulerFileMode").getValue() << "\n"; 00272 OUT << "errorOnFailureToPut: " 00273 << (services.getNode("schedulerErrorOnFailtureToPut").getValue<bool>() 00274 ? "true" 00275 : "false") 00276 << "\n"; 00277 POPTAB; 00278 00279 OUT << "}\n\n"; 00280 00281 // NetMonTransportServiceInterface 00282 OUT << "NetMonTransportServiceInterface: {\n"; 00283 00284 PUSHTAB; 00285 OUT << "service_provider: " << 00286 // services.getNode("NetMonTrasportServiceInterfaceServiceProvider").getEscapedValue() 00287 services.getNode("NetMonTrasportServiceInterfaceServiceProvider").getValue() 00288 << "\n"; 00289 OUT << "destinations: {\n"; 00290 00291 PUSHTAB; 00292 auto destinationsGroup = 00293 services.getNode("NetMonTrasportServiceInterfaceDestinationsLink"); 00294 if(!destinationsGroup.isDisconnected()) 00295 { 00296 try 00297 { 00298 auto destinations = destinationsGroup.getChildren(); 00299 for(auto& destination : destinations) 00300 { 00301 auto destinationContextUID = 00302 destination.second.getNode("destinationARTDAQContextLink") 00303 .getValueAsString(); 00304 00305 unsigned int destinationRank = 00306 contextConfig->getARTDAQAppRank(destinationContextUID); 00307 std::string host = 00308 contextConfig->getContextAddress(destinationContextUID); 00309 unsigned int port = contextConfig->getARTDAQDataPort( 00310 configManager, destinationContextUID); 00311 00312 // open destination object 00313 OUT << destination.second.getNode("destinationKey").getValue() 00314 << ": {\n"; 00315 PUSHTAB; 00316 00317 OUT << "transferPluginType: " 00318 << destination.second.getNode("transferPluginType").getValue() 00319 << __E__; 00320 00321 OUT << "destination_rank: " << destinationRank << __E__; 00322 00323 try 00324 { 00325 OUT << "max_fragment_size_bytes: " 00326 << destination.second 00327 .getNode("ARTDAQGlobalTableLink/maxFragmentSizeBytes") 00328 .getValue<unsigned long long>() 00329 << __E__; 00330 } 00331 catch(...) 00332 { 00333 __SS__ << "The field ARTDAQGlobalTableLink/maxFragmentSizeBytes " 00334 "could not be accessed. Make sure the link is valid." 00335 << __E__; 00336 __SS_THROW__; 00337 } 00338 00339 OUT << "host_map: [\n"; 00340 PUSHTAB; 00341 OUT << "{\n"; 00342 PUSHTAB; 00343 OUT << "rank: " << destinationRank << __E__; 00344 OUT << "host: \"" << host << "\"" << __E__; 00345 OUT << "portOffset: " << std::to_string(port) << __E__; 00346 POPTAB; 00347 OUT << "},\n"; 00348 OUT << "{\n"; 00349 PUSHTAB; 00350 OUT << "rank: " << selfRank << __E__; 00351 OUT << "host: \"" << selfHost << "\"" << __E__; 00352 OUT << "portOffset: " << std::to_string(selfPort) << __E__; 00353 POPTAB; 00354 OUT << "}" << __E__; 00355 POPTAB; 00356 OUT << "]" << __E__; // close host_map 00357 00358 POPTAB; 00359 OUT << "}" << __E__; // close destination object 00360 } 00361 } 00362 catch(const std::runtime_error& e) 00363 { 00364 __SS__ << "Are the Net Monitor Transport Service destinations valid? " 00365 "Error occurred looking for Event Builder transport service " 00366 "destinations for UID '" 00367 << builderNode.getValue() << "': " << e.what() << __E__; 00368 __SS_THROW__; 00369 } 00370 } 00371 POPTAB; 00372 OUT << "}\n\n"; // end destinations 00373 00374 POPTAB; 00375 OUT << "}\n\n"; // end NetMonTransportServiceInterface 00376 00377 POPTAB; 00378 OUT << "}\n\n"; // end services 00379 } 00380 00381 //-------------------------------------- 00382 // handle daq 00383 auto daq = builderNode.getNode("daqLink"); 00384 if(!daq.isDisconnected()) 00385 { 00387 OUT << "daq: {\n"; 00388 00389 // event_builder 00390 PUSHTAB; 00391 OUT << "event_builder: {\n"; 00392 00393 PUSHTAB; 00394 00395 OUT << "max_fragment_size_bytes: " 00396 << daq.getNode("daqEventBuilderMaxFragmentSizeBytes") 00397 .getValue<unsigned long long>() 00398 << __E__; 00399 OUT << "buffer_count: " 00400 << daq.getNode("daqEventBuilderBufferCount").getValue<unsigned long long>() 00401 << __E__; 00402 00403 auto parametersLink = daq.getNode("daqEventBuilderParametersLink"); 00404 if(!parametersLink.isDisconnected()) 00405 { 00406 auto parameters = parametersLink.getChildren(); 00407 for(auto& parameter : parameters) 00408 { 00409 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00410 .getValue<bool>()) 00411 PUSHCOMMENT; 00412 00413 OUT << parameter.second.getNode("daqParameterKey").getValue() << ": " 00414 << parameter.second.getNode("daqParameterValue").getValue() << "\n"; 00415 00416 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00417 .getValue<bool>()) 00418 POPCOMMENT; 00419 } 00420 } 00421 OUT << "\n"; // end daq event builder parameters 00422 00423 OUT << "sources: {\n"; 00424 00425 PUSHTAB; 00426 auto sourcesGroup = daq.getNode("daqEventBuilderSourcesLink"); 00427 if(!sourcesGroup.isDisconnected()) 00428 { 00429 try 00430 { 00431 auto sources = sourcesGroup.getChildren(); 00432 for(auto& source : sources) 00433 { 00434 auto sourceContextUID = 00435 source.second.getNode("sourceARTDAQContextLink") 00436 .getValueAsString(); 00437 00438 unsigned int sourceRank = 00439 contextConfig->getARTDAQAppRank(sourceContextUID); 00440 std::string host = contextConfig->getContextAddress(sourceContextUID); 00441 unsigned int port = 00442 contextConfig->getARTDAQDataPort(configManager, sourceContextUID); 00443 00444 // open source object 00445 OUT << source.second.getNode("sourceKey").getValue() << ": {\n"; 00446 PUSHTAB; 00447 00448 OUT << "transferPluginType: " 00449 << source.second.getNode("transferPluginType").getValue() 00450 << __E__; 00451 00452 OUT << "source_rank: " << sourceRank << __E__; 00453 00454 try 00455 { 00456 OUT << "max_fragment_size_bytes: " 00457 << source.second 00458 .getNode("ARTDAQGlobalTableLink/maxFragmentSizeBytes") 00459 .getValue<unsigned long long>() 00460 << __E__; 00461 } 00462 catch(...) 00463 { 00464 __SS__ << "The field ARTDAQGlobalTableLink/maxFragmentSizeBytes " 00465 "could not be accessed. Make sure the link is valid." 00466 << __E__; 00467 __SS_THROW__; 00468 } 00469 00470 OUT << "host_map: [\n"; 00471 PUSHTAB; 00472 OUT << "{\n"; 00473 PUSHTAB; 00474 OUT << "rank: " << sourceRank << __E__; 00475 OUT << "host: \"" << host << "\"" << __E__; 00476 OUT << "portOffset: " << std::to_string(port) << __E__; 00477 POPTAB; 00478 OUT << "},\n"; 00479 OUT << "{\n"; 00480 PUSHTAB; 00481 OUT << "rank: " << selfRank << __E__; 00482 OUT << "host: \"" << selfHost << "\"" << __E__; 00483 OUT << "portOffset: " << std::to_string(selfPort) << __E__; 00484 POPTAB; 00485 OUT << "}" << __E__; 00486 POPTAB; 00487 OUT << "]" << __E__; // close host_map 00488 00489 POPTAB; 00490 OUT << "}" << __E__; // close source object 00491 } 00492 } 00493 catch(const std::runtime_error& e) 00494 { 00495 __SS__ << "Are the DAQ sources valid? Error occurred looking for Event " 00496 "Builder DAQ sources for UID '" 00497 << builderNode.getValue() << "': " << e.what() << __E__; 00498 __SS_THROW__; 00499 } 00500 } 00501 POPTAB; 00502 OUT << "}\n\n"; // end sources 00503 00504 POPTAB; 00505 OUT << "}\n\n"; // end event builder 00506 00507 OUT << "metrics: {\n"; 00508 00509 PUSHTAB; 00510 auto metricsGroup = daq.getNode("daqMetricsLink"); 00511 if(!metricsGroup.isDisconnected()) 00512 { 00513 auto metrics = metricsGroup.getChildren(); 00514 00515 for(auto& metric : metrics) 00516 { 00517 if(!metric.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00518 .getValue<bool>()) 00519 PUSHCOMMENT; 00520 00521 OUT << metric.second.getNode("metricKey").getValue() << ": {\n"; 00522 PUSHTAB; 00523 00524 OUT << "metricPluginType: " 00525 << metric.second.getNode("metricPluginType").getValue() << "\n"; 00526 OUT << "level: " << metric.second.getNode("metricLevel").getValue() 00527 << "\n"; 00528 00529 auto metricParametersGroup = 00530 metric.second.getNode("metricParametersLink"); 00531 if(!metricParametersGroup.isDisconnected()) 00532 { 00533 auto metricParameters = metricParametersGroup.getChildren(); 00534 for(auto& metricParameter : metricParameters) 00535 { 00536 if(!metricParameter.second 00537 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00538 .getValue<bool>()) 00539 PUSHCOMMENT; 00540 00541 OUT << metricParameter.second.getNode("metricParameterKey") 00542 .getValue() 00543 << ": " 00544 << metricParameter.second.getNode("metricParameterValue") 00545 .getValue() 00546 << "\n"; 00547 00548 if(!metricParameter.second 00549 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00550 .getValue<bool>()) 00551 POPCOMMENT; 00552 } 00553 } 00554 POPTAB; 00555 OUT << "}\n\n"; // end metric 00556 00557 if(!metric.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00558 .getValue<bool>()) 00559 POPCOMMENT; 00560 } 00561 } 00562 POPTAB; 00563 OUT << "}\n\n"; // end metrics 00564 00565 POPTAB; 00566 OUT << "}\n\n"; // end daq 00567 } 00568 00569 //-------------------------------------- 00570 // handle outputs 00571 auto outputs = builderNode.getNode("outputsLink"); 00572 if(!outputs.isDisconnected()) 00573 { 00574 OUT << "outputs: {\n"; 00575 00576 PUSHTAB; 00577 00578 auto outputPlugins = outputs.getChildren(); 00579 for(auto& outputPlugin : outputPlugins) 00580 { 00581 if(!outputPlugin.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00582 .getValue<bool>()) 00583 PUSHCOMMENT; 00584 00585 std::string moduleType = 00586 outputPlugin.second.getNode("outputModuleType").getValue(); 00587 00588 OUT << outputPlugin.second.getNode("outputKey").getValue() << ": {\n"; 00589 PUSHTAB; 00590 00591 OUT << "module_type: " << moduleType << "\n"; 00592 00593 auto pluginParameterLink = 00594 outputPlugin.second.getNode("outputModuleParameterLink"); 00595 if(!pluginParameterLink.isDisconnected()) 00596 { 00597 auto pluginParameters = pluginParameterLink.getChildren(); 00598 for(auto& pluginParameter : pluginParameters) 00599 { 00600 if(!pluginParameter.second 00601 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00602 .getValue<bool>()) 00603 PUSHCOMMENT; 00604 00605 OUT << pluginParameter.second.getNode("outputParameterKey").getValue() 00606 << ": " 00607 << pluginParameter.second.getNode("outputParameterValue") 00608 .getValue() 00609 << "\n"; 00610 00611 if(!pluginParameter.second 00612 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00613 .getValue<bool>()) 00614 POPCOMMENT; 00615 } 00616 } 00617 00618 // ONLY For output module type 'BinaryNetOuput,' allow destinations 00619 auto destinationsGroup = 00620 outputPlugin.second.getNode("outputModuleDestinationLink"); 00621 if(!destinationsGroup.isDisconnected()) 00622 { 00623 try 00624 { 00625 if(moduleType.find("BinaryNetOuput") == std::string::npos) 00626 { 00627 __SS__ << "Illegal output module type '" << moduleType 00628 << "' to include destinations. Only modules of type " 00629 "'BinaryNetOuput' " 00630 << "are allowed to have destinations." << __E__; 00631 __SS_THROW__; 00632 } 00633 00634 OUT << "destinations: {\n"; 00635 PUSHTAB; 00636 00637 auto destinations = destinationsGroup.getChildren(); 00638 for(auto& destination : destinations) 00639 try 00640 { 00641 auto destinationContextUID = 00642 destination.second.getNode("destinationARTDAQContextLink") 00643 .getValueAsString(); 00644 00645 unsigned int destinationRank = 00646 contextConfig->getARTDAQAppRank(destinationContextUID); 00647 std::string host = 00648 contextConfig->getContextAddress(destinationContextUID); 00649 unsigned int port = contextConfig->getARTDAQDataPort( 00650 configManager, destinationContextUID); 00651 00652 // open destination object 00653 OUT << destination.second.getNode("destinationKey").getValue() 00654 << ": {\n"; 00655 PUSHTAB; 00656 00657 OUT << "transferPluginType: " 00658 << destination.second.getNode("transferPluginType") 00659 .getValue() 00660 << __E__; 00661 00662 OUT << "destination_rank: " << destinationRank << __E__; 00663 00664 try 00665 { 00666 OUT << "max_fragment_size_bytes: " 00667 << destination.second 00668 .getNode( 00669 "ARTDAQGlobalTableLink/" 00670 "maxFragmentSizeBytes") 00671 .getValue<unsigned long long>() 00672 << __E__; 00673 } 00674 catch(...) 00675 { 00676 __SS__ 00677 << "The field " 00678 "ARTDAQGlobalTableLink/maxFragmentSizeBytes could " 00679 "not be accessed. Make sure the link is valid." 00680 << __E__; 00681 __SS_THROW__; 00682 } 00683 00684 OUT << "host_map: [\n"; 00685 PUSHTAB; 00686 OUT << "{\n"; 00687 PUSHTAB; 00688 OUT << "rank: " << destinationRank << __E__; 00689 OUT << "host: \"" << host << "\"" << __E__; 00690 OUT << "portOffset: " << std::to_string(port) << __E__; 00691 POPTAB; 00692 OUT << "},\n"; 00693 OUT << "{\n"; 00694 PUSHTAB; 00695 OUT << "rank: " << selfRank << __E__; 00696 OUT << "host: \"" << selfHost << "\"" << __E__; 00697 OUT << "portOffset: " << std::to_string(selfPort) << __E__; 00698 POPTAB; 00699 OUT << "}" << __E__; 00700 POPTAB; 00701 OUT << "]" << __E__; // close host_map 00702 00703 POPTAB; 00704 OUT << "}" << __E__; // close destination object 00705 } 00706 catch(const std::runtime_error& e) 00707 { 00708 __SS__ << "Error encountered populating parameters for " 00709 "output module destination '" 00710 << destination.first 00711 << "'... Please verify fields. Here was the error: " 00712 << e.what() << __E__; 00713 __SS_ONLY_THROW__; 00714 } 00715 00716 POPTAB; 00717 OUT << "}\n\n"; // end destinations 00718 } 00719 catch(const std::runtime_error& e) 00720 { 00721 __SS__ << "Are the Output module destinations valid? " 00722 "Error occurred looking for Event Builder output module " 00723 "destinations for UID '" 00724 << outputPlugin.second.getValue() << "': " << e.what() 00725 << __E__; 00726 __SS_THROW__; 00727 } 00728 } 00729 00730 POPTAB; 00731 OUT << "}\n\n"; // end output module 00732 00733 if(!outputPlugin.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00734 .getValue<bool>()) 00735 POPCOMMENT; 00736 } 00737 00738 POPTAB; 00739 OUT << "}\n\n"; // end outputs 00740 } 00741 00742 //-------------------------------------- 00743 // handle physics 00744 auto physics = builderNode.getNode("physicsLink"); 00745 if(!physics.isDisconnected()) 00746 { 00748 OUT << "physics: {\n"; 00749 00750 PUSHTAB; 00751 00752 auto analyzers = physics.getNode("analyzersLink"); 00753 if(!analyzers.isDisconnected()) 00754 { 00756 OUT << "analyzers: {\n"; 00757 00758 PUSHTAB; 00759 auto modules = analyzers.getChildren(); 00760 for(auto& module : modules) 00761 { 00762 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00763 .getValue<bool>()) 00764 PUSHCOMMENT; 00765 00766 OUT << module.second.getNode("analyzerKey").getValue() << ": {\n"; 00767 PUSHTAB; 00768 OUT << "module_type: " 00769 << module.second.getNode("analyzerModuleType").getValue() << "\n"; 00770 auto moduleParameterLink = 00771 module.second.getNode("analyzerModuleParameterLink"); 00772 if(!moduleParameterLink.isDisconnected()) 00773 { 00774 auto moduleParameters = moduleParameterLink.getChildren(); 00775 for(auto& moduleParameter : moduleParameters) 00776 { 00777 if(!moduleParameter.second 00778 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00779 .getValue<bool>()) 00780 PUSHCOMMENT; 00781 00782 OUT << moduleParameter.second.getNode("analyzerParameterKey") 00783 .getValue() 00784 << ": " 00785 << moduleParameter.second.getNode("analyzerParameterValue") 00786 .getValue() 00787 << "\n"; 00788 00789 if(!moduleParameter.second 00790 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00791 .getValue<bool>()) 00792 POPCOMMENT; 00793 } 00794 } 00795 POPTAB; 00796 OUT << "}\n\n"; // end analyzer module 00797 00798 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00799 .getValue<bool>()) 00800 POPCOMMENT; 00801 } 00802 POPTAB; 00803 OUT << "}\n\n"; // end analyzer 00804 } 00805 00806 auto producers = physics.getNode("producersLink"); 00807 if(!producers.isDisconnected()) 00808 { 00810 OUT << "producers: {\n"; 00811 00812 PUSHTAB; 00813 auto modules = producers.getChildren(); 00814 for(auto& module : modules) 00815 { 00816 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00817 .getValue<bool>()) 00818 PUSHCOMMENT; 00819 00820 OUT << module.second.getNode("producerKey").getValue() << ": {\n"; 00821 PUSHTAB; 00822 OUT << "module_type: " 00823 << module.second.getNode("producerModuleType").getValue() << "\n"; 00824 auto moduleParameterLink = 00825 module.second.getNode("producerModuleParameterLink"); 00826 if(!moduleParameterLink.isDisconnected()) 00827 { 00828 auto moduleParameters = moduleParameterLink.getChildren(); 00829 for(auto& moduleParameter : moduleParameters) 00830 { 00831 if(!moduleParameter.second 00832 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00833 .getValue<bool>()) 00834 PUSHCOMMENT; 00835 00836 OUT << moduleParameter.second.getNode("producerParameterKey") 00837 .getValue() 00838 << ":" 00839 << moduleParameter.second.getNode("producerParameterValue") 00840 .getValue() 00841 << "\n"; 00842 00843 if(!moduleParameter.second 00844 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00845 .getValue<bool>()) 00846 POPCOMMENT; 00847 } 00848 } 00849 POPTAB; 00850 OUT << "}\n\n"; // end producer module 00851 00852 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00853 .getValue<bool>()) 00854 POPCOMMENT; 00855 } 00856 POPTAB; 00857 OUT << "}\n\n"; // end producer 00858 } 00859 00860 auto filters = physics.getNode("filtersLink"); 00861 if(!filters.isDisconnected()) 00862 { 00864 OUT << "filters: {\n"; 00865 00866 PUSHTAB; 00867 auto modules = filters.getChildren(); 00868 for(auto& module : modules) 00869 { 00870 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00871 .getValue<bool>()) 00872 PUSHCOMMENT; 00873 00874 OUT << module.second.getNode("filterKey").getValue() << ": {\n"; 00875 PUSHTAB; 00876 OUT << "module_type: " 00877 << module.second.getNode("filterModuleType").getValue() << "\n"; 00878 auto moduleParameterLink = 00879 module.second.getNode("filterModuleParameterLink"); 00880 if(!moduleParameterLink.isDisconnected()) 00881 { 00882 auto moduleParameters = moduleParameterLink.getChildren(); 00883 for(auto& moduleParameter : moduleParameters) 00884 { 00885 if(!moduleParameter.second 00886 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00887 .getValue<bool>()) 00888 PUSHCOMMENT; 00889 00890 OUT << moduleParameter.second.getNode("filterParameterKey") 00891 .getValue() 00892 << ": " 00893 << moduleParameter.second.getNode("filterParameterValue") 00894 .getValue() 00895 << "\n"; 00896 00897 if(!moduleParameter.second 00898 .getNode(TableViewColumnInfo::COL_NAME_STATUS) 00899 .getValue<bool>()) 00900 POPCOMMENT; 00901 } 00902 } 00903 POPTAB; 00904 OUT << "}\n\n"; // end filter module 00905 00906 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00907 .getValue<bool>()) 00908 POPCOMMENT; 00909 } 00910 POPTAB; 00911 OUT << "}\n\n"; // end filter 00912 } 00913 00914 auto otherParameterLink = physics.getNode("physicsOtherParametersLink"); 00915 if(!otherParameterLink.isDisconnected()) 00916 { 00918 auto physicsParameters = otherParameterLink.getChildren(); 00919 for(auto& parameter : physicsParameters) 00920 { 00921 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00922 .getValue<bool>()) 00923 PUSHCOMMENT; 00924 00925 OUT << parameter.second.getNode("physicsParameterKey").getValue() << ": " 00926 << parameter.second.getNode("physicsParameterValue").getValue() 00927 << "\n"; 00928 00929 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS) 00930 .getValue<bool>()) 00931 POPCOMMENT; 00932 } 00933 } 00934 POPTAB; 00935 OUT << "}\n\n"; // end physics 00936 } 00937 00938 //-------------------------------------- 00939 // handle source 00940 auto source = builderNode.getNode("sourceLink"); 00941 if(!source.isDisconnected()) 00942 { 00943 OUT << "source: {\n"; 00944 00945 PUSHTAB; 00946 OUT << "module_type: " << source.getNode("sourceModuleType").getValue() << "\n"; 00947 OUT << "waiting_time: " << source.getNode("sourceWaitingTime").getValue() << "\n"; 00948 OUT << "resume_after_timeout: " 00949 << (source.getNode("sourceResumeAfterTimeout").getValue<bool>() ? "true" 00950 : "false") 00951 << "\n"; 00952 POPTAB; 00953 OUT << "}\n\n"; // end source 00954 } 00955 00956 //-------------------------------------- 00957 // handle process_name 00958 OUT << "process_name: " 00959 << builderNode.getNode( 00960 "ARTDAQGlobalTableForProcessNameLink/processNameForBuilders") 00961 << "\n"; 00962 00963 out.close(); 00964 } 00965 00966 DEFINE_OTS_TABLE(ARTDAQBuilderTable)