43 string loadLibs = fConfig->GetValue<
string>(
"libs-to-load");
44 if (loadLibs.length() > 0) {
45 LOG(info) <<
"There are libraries to load.";
46 if (loadLibs.find(
";") != std::string::npos) {
47 LOG(info) <<
"There are several libraries to load";
48 istringstream f(loadLibs);
50 while (getline(f, s,
';')) {
51 LOG(info) <<
"Load library " << s;
52 gSystem->Load(s.c_str());
56 LOG(info) <<
"Load library " << loadLibs;
57 gSystem->Load(loadLibs.c_str());
61 LOG(info) <<
"There are no libraries to load.";
68 fOutputName = fConfig->GetValue<
string>(
"output-name");
69 fOutputType = fConfig->GetValue<
string>(
"output-type");
70 fChannelName = fConfig->GetValue<
string>(
"channel-name");
72 fsSetupName = fConfig->GetValue<std::string>(
"setup");
79 FairParRootFileIo* par1R =
new FairParRootFileIo();
81 fRtdb->setFirstInput(par1R);
84 FairParAsciiFileIo* par1A =
new FairParAsciiFileIo();
86 LOG(info) <<
"File list found!";
87 TList* parFileList =
new TList();
88 TObjString* parFile(NULL);
91 while (getline(f, s,
';')) {
92 LOG(info) <<
"File: " << s;
93 parFile =
new TObjString(s.c_str());
94 parFileList->Add(parFile);
95 par1A->open(parFileList,
"in");
99 LOG(info) <<
"Single input file found!";
102 fRtdb->setFirstInput(par1A);
108 FairParRootFileIo* par2R =
new FairParRootFileIo();
110 fRtdb->setSecondInput(par2R);
113 FairParAsciiFileIo* par2A =
new FairParAsciiFileIo();
115 LOG(info) <<
"File list found!";
116 TList* parFileList =
new TList();
117 TObjString* parFile(NULL);
120 while (getline(f, s,
';')) {
121 LOG(info) <<
"File: " << s;
122 parFile =
new TObjString(s.c_str());
123 parFileList->Add(parFile);
124 par2A->open(parFileList,
"in");
128 LOG(info) <<
"Single input file found!";
131 fRtdb->setSecondInput(par2A);
138 FairParRootFileIo* parOut =
new FairParRootFileIo(kTRUE);
140 fRtdb->setOutput(parOut);
158 string parameterName =
"";
159 FairParGenericSet* par =
nullptr;
162 FairMQMessagePtr req(NewMessage());
165 string reqStr(
static_cast<char*
>(req->GetData()), req->GetSize());
166 LOG(info) <<
"Received parameter request from client: \"" << reqStr <<
"\"";
168 if (
"setup" == reqStr) {
174 TMessage* tmsg =
new TMessage(kMESS_OBJECT);
175 tmsg->WriteObject(&exchangableSetup);
177 FairMQMessagePtr rep(NewMessage(
178 tmsg->Buffer(), tmsg->BufferSize(),
179 [](
void* ,
void*
object) { delete static_cast<TMessage*>(object); }, tmsg));
182 LOG(error) <<
"failed sending reply to Setup request";
187 LOG(error) <<
"CbmSetup uninitialized!";
189 FairMQMessagePtr rep(NewMessage());
191 LOG(error) <<
"failed sending reply to Setup request";
197 size_t pos = reqStr.rfind(
",");
198 string newParameterName = reqStr.substr(0,
pos);
199 int runId = stoi(reqStr.substr(
pos + 1));
200 LOG(info) <<
"Parameter name: " << newParameterName;
201 LOG(info) <<
"Run ID: " << runId;
203 LOG(info) <<
"Retrieving parameter...";
205 if (newParameterName != parameterName) {
206 parameterName = newParameterName;
207 par =
static_cast<FairParGenericSet*
>(
fRtdb->getContainer(parameterName.c_str()));
209 LOG(info) <<
"Retrieving parameter...Done";
211 if (-1 != runId) {
fRtdb->initContainers(runId); }
213 LOG(info) <<
"Sending following parameter to the client:";
217 TMessage* tmsg =
new TMessage(kMESS_OBJECT);
218 tmsg->WriteObject(par);
220 FairMQMessagePtr rep(NewMessage(
221 tmsg->Buffer(), tmsg->BufferSize(),
222 [](
void* ,
void*
object) { delete static_cast<TMessage*>(object); }, tmsg));
225 LOG(error) <<
"failed sending reply";
230 LOG(error) <<
"Parameter uninitialized!";
232 FairMQMessagePtr rep(NewMessage());
234 LOG(error) <<
"failed sending reply";