00001 #include "otsdaq-core/ARTDAQDataManager/ARTDAQDataManager.h"
00002 #include "otsdaq-core/DataProcessorPlugins/ARTDAQConsumer.h"
00003 #include "otsdaq-core/DataProcessorPlugins/ARTDAQProducer.h"
00004
00005 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
00006
00007 #include <iostream>
00008 #include <cassert>
00009
00010 using namespace ots;
00011
00012
00013
00014 ARTDAQDataManager::ARTDAQDataManager(const ConfigurationTree& theXDAQContextConfigTree, const std::string& supervisorConfigurationPath)
00015 : DataManager (theXDAQContextConfigTree, supervisorConfigurationPath)
00016 {
00017 INIT_MF("BoardReaderDataManager");
00018 __COUT__ << "Begin!" << std::endl;
00019 __COUT__ << "Begin!" << std::endl;
00020 __COUT__ << "Begin!" << std::endl;
00021 __COUT__ << "Begin!" << std::endl;
00022 __COUT__ << "Begin!" << std::endl;
00023
00024
00025
00026 std::string name = "BoardReader";
00027
00028 __CFG_MOUT__ << "artdaq version " <<
00029
00030 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getPackageVersion()
00031 << ", built " <<
00032 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getBuildTimestamp();
00033
00034 INIT_MF((name + "App").c_str());
00035
00036
00037
00038
00039 __COUT__ << "MF initialized" << std::endl;
00040
00041 rank_ = Configurable::getApplicationLID();
00042
00043 __COUTV__(rank_);
00044
00045 unsigned short port = 5100;
00046
00047
00048
00049
00050
00051 __COUT__ << "END" << std::endl;
00052
00053
00054 __COUT__ << "Initialized!" << std::endl;
00055 __COUT__ << "Initialized!" << std::endl;
00056 __COUT__ << "Initialized!" << std::endl;
00057 __COUT__ << "Initialized!" << std::endl;
00058 __COUT__ << "Initialized!" << std::endl;
00059 }
00060
00061
00062 ARTDAQDataManager::~ARTDAQDataManager(void)
00063 {}
00064
00065
00066 void ARTDAQDataManager::configure(void)
00067 {
00068 __COUT__ << "ARTDAQDataManager configuring..." << std::endl;
00069
00070 DataManager::configure();
00071
00072 __COUT__ << "ARTDAQDataManager DataManager configured now pass the MPI stuff" << std::endl;
00073 for(auto it=DataManager::buffers_.begin(); it!=DataManager::buffers_.end(); it++)
00074 for(auto& itc: it->second.consumers_)
00075 if(dynamic_cast<ARTDAQConsumer*>(itc.get()))
00076 {
00077 dynamic_cast<ARTDAQConsumer*>(itc.get())->initLocalGroup(rank_);
00078 return;
00079 }
00080
00081 __SS__ << "There was no ARTDAQ Consumer found on a buffer!" << std::endl;
00082 __COUT__ << ss.str();
00083
00084 __COUT__ << "Looking for an ARTDAQ Producer..." << std::endl;
00085
00086 for(auto it=DataManager::buffers_.begin(); it!=DataManager::buffers_.end(); it++)
00087 for(auto& itc: it->second.producers_)
00088 if(dynamic_cast<ARTDAQProducer*>(itc.get()))
00089 {
00090 dynamic_cast<ARTDAQProducer*>(itc.get())->initLocalGroup(rank_);
00091 return;
00092 }
00093
00094 __COUT__ << "No ARTDAQ Producers found either... so error!" << std::endl;
00095
00096 __COUT_ERR__ << ss.str();
00097 throw std::runtime_error(ss.str());
00098 }
00099
00100
00101
00102 void ARTDAQDataManager::stop(void)
00103 {
00104 DataManager::stop();
00105 }