BmnRoot
Loading...
Searching...
No Matches
GeoSetup.cxx
Go to the documentation of this file.
1#include "GeoSetup.h"
2
3#include "BmnNewFieldMap.h"
4#include "FairModule.h"
5#include "FairRunAna.h"
6#include "TGeoBBox.h"
7#include "TGeoBoolNode.h"
8#include "TGeoCompositeShape.h"
9#include "TGeoCone.h"
10#include "TGeoManager.h"
11#include "TGeoMatrix.h"
12#include "TGeoTrd2.h"
13#include "TGeoTube.h"
14#include "TKey.h"
15#include "TSQLResult.h"
16#include "TSQLRow.h"
17#include "TSQLiteServer.h"
18#include "TSystem.h"
19#include "TXMLEngine.h"
20
21#include <cctype>
22#include <cstring>
23#include <iostream>
24#include <sys/stat.h> /* stat */
25#include <time.h> /* time */
26
27bool GeoSetup::exists_file(const char* name)
28{
29 return (access(name, F_OK) != -1);
30}
31
32bool ichar_equals(char a, char b)
33{
34 return std::tolower(static_cast<unsigned char>(a)) == std::tolower(static_cast<unsigned char>(b));
35}
36
37unsigned long int GeoSetup::GetServerRevision(const char* url)
38{
39 unsigned long int serverRev = 0;
40 gSystem->Exec(TString::Format("wget -O server_revision.txt \"%s/get_cur_timestamp.php\" > /dev/null 2>&1", url));
41 std::ifstream myFile_Handler;
42 std::string myLine;
43 myFile_Handler.open("server_revision.txt");
44 if (myFile_Handler.is_open()) {
45 char* ptr;
46 while (getline(myFile_Handler, myLine)) {
47 serverRev = strtoul(myLine.c_str(), &ptr, 10);
48 break;
49 }
50 myFile_Handler.close();
51 std::remove("server_revision.txt");
52 }
53 return serverRev;
54}
55string_view GeoSetup::GetLastApprovedSetupTag(string_view pattern){
56 std::pair<int,string_view> res = GetTagName4PatternServer(pattern);
57 if(res.first==1)
58 return res.second;
59 CloseDB();
60 TString localDbPath = gSystem->ExpandPathName(getenv("DBL_FILE_PATH"));
61 res = GetTagName4PatternLocal(pattern,localDbPath);
62 CloseDB();
63 if(res.first==1)
64 return res.second;
65 TString result="Setup not found for patter:"+std::string(pattern);
66 throw std::invalid_argument(result);
67}
68std::pair<int,string_view> GeoSetup::GetTagName4PatternServer(string_view pattern_tag, const char* url){
69 std::pair<int,string_view> res = std::make_pair<int,string_view>(0,"");
70 std::remove("setup_name.txt");
71 TString command = TString::Format("wget -O setup_name.txt \"%s/get_setup_name.php?tag=%s\" > /dev/null 2>&1", url,pattern_tag.data());
72 gSystem->Exec(command);
73 std::ifstream myFile_Handler;
74 std::string myLine;
75 myFile_Handler.open("setup_list.txt");
76 if (myFile_Handler.is_open()) {
77 getline(myFile_Handler, myLine);
78 std::size_t found = myLine.find(";");
79 if(found==std::string::npos){
80 return res;
81 }
82 //myLine=myLine.substr(0,found);
83 vector<string> results;
84 istringstream f(myLine);
85 std::string token;
86 while (getline(f, token, ':')) {
87 results.push_back(token);
88 }
89 if(results.size()!=3)
90 return res;
91 res = std::make_pair<int,string_view>(1,results[0]);
92 }
93 myFile_Handler.close();
94 //std::remove("setup_name.txt");
95 return res;
96}
97
98std::pair<int, uint64_t> GeoSetup::CheckTagOnServer(string_view setup_tag, const char* url)
99{
100 int retval = -1;
101 gSystem->Exec(TString::Format("wget -O server_setup_list.txt \"%s/get_setup_list.php\" > /dev/null 2>&1", url));
102 std::ifstream myFile_Handler;
103 std::string myLine;
104 std::string sTag(setup_tag);
105 myFile_Handler.open("server_setup_list.txt");
106 if (myFile_Handler.is_open()) {
107 while (getline(myFile_Handler, myLine)) {
108 istringstream f(myLine);
109 string s;
110 while (getline(f, s, ';')) {
111 vector<string> results;
112 std::string token;
113 std::istringstream input;
114 input.str(s);
115 //std::cerr<<"s="<<s<<std::endl;
116 while (getline(input, token, ':')) { // Specify the delimiter
117 results.push_back(token);
118 //std::cerr<<"push:"<<token<<std::endl;
119 }
120 if(results.size()<2)
121 continue;//wrong format
122 std::string tag = results[0];
123 std::string status = results[1];
124 uint64_t upTime=0;
125 if(results.size()>2){
126 upTime=std::stoull(results[2], nullptr, 10);
127 }
128 bool bb = std::equal(tag.begin(), tag.end(), sTag.begin(), sTag.end(), ichar_equals);
129 if (tag.size() == sTag.size() && bb){
130 //std::cerr<<"before return"<<std::endl;
131 myFile_Handler.close();
132 std::remove("server_setup_list.txt");
133 return std::make_pair(std::stoi(status),upTime);
134 }
135
136 /* std::string::size_type pos = 0;
137 if ((pos = s.find(':', pos)) != std::string::npos) {
138 std::string tag(s.substr(0, pos));
139 std::string ext(s.substr(pos + 1));
140
141 std::string status(s.substr(pos + 1));
142 bool bb = std::equal(tag.begin(), tag.end(), sTag.begin(), sTag.end(), ichar_equals);
143 if (tag.size() == sTag.size() && bb)
144 return std::stoi(status);
145 }*/
146 }
147 break;
148 }
149 myFile_Handler.close();
150 std::remove("server_setup_list.txt");
151 }
152 return std::make_pair(retval,0);
153}
154
155std::pair<int,string_view> GeoSetup::GetTagName4PatternLocal(string_view pattern_tag,TString& localDbPath){
156 std::pair<int,string_view> res = std::make_pair<int,string_view>(0,"");
157 if (exists_file(localDbPath)) {
158 std::ostringstream stringStream;
159 stringStream << "sqlite://" << localDbPath;
160 TSQLiteServer db(stringStream.str().c_str());
161 stringStream.str("");
162 if (db.IsConnected()) {
163 //stringStream << "SELECT setup_tag, status, creation_date FROM setup where status=1 and setup_tag like '"<<pattern_tag.data()<<"%' and not (setup_tag like '"<<pattern_tag.data()<<"_dev%') order by creation_date DESC limit 1;";
164 stringStream << "SELECT setup_tag, status, creation_date FROM setup where status=1 and setup_tag like '"<<pattern_tag.data()<<"%' order by creation_date DESC limit 1;";
165 TSQLResult* resQ = db.Query(stringStream.str().c_str());
166 if (resQ != 0) {
167 TSQLRow* row = resQ->Next();
168 if (row != NULL) {
169 const char* name = row->GetField(0);
170 res = std::make_pair<int,string_view>(1,name);
171 }
172 }
173 }
174 }
175 return res;
176}
177unsigned long int GeoSetup::GetLocalRevision(TString& localDbPath)
178{
179 unsigned long int localRev = 0;
180 // char type;
181 if (exists_file(localDbPath)) {
182 std::ostringstream stringStream;
183 stringStream << "sqlite://" << localDbPath;
184 TSQLiteServer db(stringStream.str().c_str());
185 stringStream.str("");
186 if (db.IsConnected()) {
187 stringStream << "select value_field from config where key_field='config_time';";
188 //cout << stringStream.str().c_str() << std::endl;
189 TSQLResult* resQ = db.Query(stringStream.str().c_str());
190 if (resQ != 0) {
191 TSQLRow* row = resQ->Next();
192 if (row != NULL) {
193 const char* ch_time = row->GetField(0);
194 char* ptr;
195 if (ch_time != NULL)
196 localRev = strtoul(ch_time, &ptr, 10);
197 }
198 }
199 }
200 }
201 return localRev;
202}
203
204int GeoSetup::installLocalDB(string_view setup_tag, const char* url)
205{
206 CloseDB();
207 TString localDbPath = gSystem->ExpandPathName(getenv("DBL_FILE_PATH"));
208 if (localDbPath == "") {
209 LOG(error) << "DBL_FILE_PATH is not set. Please, set DBL_FILE_PATH as a path to the local database file (default, "
210 "'local.db')"
211 << endl;
212 return -1;
213 }
214 FileStat_t file_stat;
215 gSystem->GetPathInfo(localDbPath.Data(), file_stat);
216 if (R_ISDIR(file_stat.fMode)) {
217 LOG(error) << "DBL_FILE_PATH is a path to a folder. Please, set DBL_FILE_PATH as a path to the local database file "
218 "(default, 'local.db')"
219 << endl;
220 return -2;
221 }
222
223 TString dirName(gSystem->DirName(localDbPath.Data()));
224 TString fileName(gSystem->BaseName(localDbPath.Data()));
225 if (!exists_file(dirName.Data()))
226 if (gSystem->mkdir(dirName, true) != 0) {
227 LOG(error) << "ERROR: cannot create folder: " << dirName << endl;
228 return -3;
229 }
230 TString command;
231 if (setup_tag.size() == 0)
232 command = TString::Format("wget -O testdb.tar \"%s/download_file.php?type=all&tag=all\" > /dev/null 2>&1", url);
233 else {
234 std::string tag(setup_tag);
235 command = TString::Format("wget -O testdb.tar \"%s/download_file.php?type=s&tag=%s&rev=1\" > /dev/null 2>&1",
236 url, tag.c_str());
237 }
238 gSystem->Exec(command);
239 if (!exists_file("testdb.tar")) {
240 LOG(error) << "ERROR: downloading the geometry database file failed, please, check url: " << url << endl;
241 return -4;
242 }
243 gSystem->GetPathInfo("testdb.tar", file_stat);
244 if (file_stat.fSize == 0) {
245 LOG(error) << "ERROR: downloaded geometry database file has 0 size, please, check url: " << url << endl;
246 return -5;
247 }
248 // untar archive with the database file
249 gSystem->Exec(TString::Format("tar -xvf testdb.tar -C \"%s/\" > /dev/null 2>&1", dirName.Data()));
250 // remove temporary archive
251 gSystem->Exec("rm -rf testdb.tar");
252 if (fileName != "local.db") {
253 gSystem->CopyFile(gSystem->ConcatFileName(dirName.Data(), "local.db"),
254 gSystem->ConcatFileName(dirName.Data(), fileName.Data()), kTRUE);
255 gSystem->Unlink(gSystem->ConcatFileName(dirName.Data(), "local.db"));
256 }
257 if (!OpenLocalGeoDatabase())
258 return -6;
259 LOG(info) << "The Local Geometry Database was successfully installed to the directory: " << dirName << endl;
260 return 0;
261}
262
263void GeoSetup::CloseDB()
264{
265 m_modules_table.clear();
266 m_modules_revision_table.clear();
267 if (m_db != nullptr) {
268 m_db->Close();
269 delete m_db;
270 m_db = nullptr;
271 }
272}
273
274// GeoSetup destructor
276{
277 // CloseDB();
278}
279
280// create connection to the Local Geometry Database and fill the tables with modules and their revisions
281bool GeoSetup::OpenLocalGeoDatabase()
282{
283 const char* env_p = getenv("DBL_FILE_PATH");
284 if (env_p == nullptr) {
285 LOG(error) << "Please, set DBL_FILE_PATH environment variable before using the Geometry Database";
286 return false;
287 }
288 if (!exists_file(gSystem->ExpandPathName(env_p))) {
289 LOG(error) << "No Database found in " << gSystem->ExpandPathName(env_p);
290 return false;
291 }
292 ostringstream stringStream;
293 stringStream << "sqlite://" << gSystem->ExpandPathName(env_p);
294
295 LOG(debug1) << "Connecting the Local Geometry Database at path: " << stringStream.str().c_str();
296 // std::cerr<<"Connecting the Local Geometry Database at path: "<<stringStream.str().c_str()<<std::endl;
297 m_db = new TSQLiteServer(stringStream.str().c_str());
298 if (PutModules() != 0) {
299 LOG(error) << "Cannot load detector geometry, please, check DBL_FILE_PATH environment variable";
300 return false;
301 }
302 if (PutModuleRevisions() != 0) {
303 LOG(error) << "Cannot load detector geometry, please, check DBL_FILE_PATH environment variable";
304 return false;
305 }
306
307 return true;
308}
309
310//-1 problem to load DB. Require to check DBL_FILE_PATH environment variable.
311//-2 No geometry setup found for the given tag
312//-3 Setup is damaged.
313// load selected geometry setup from the Local Geometry Database and create gGeoManager instance
314int GeoSetup::LoadSetupToGeoManager(string_view setup_tag)
315{
316 const char* env_p = getenv("DBL_FILE_PATH");
317 if (env_p == nullptr) {
318 LOG(error) << "Please, set DBL_FILE_PATH environment variable before using the Geometry Database";
319 return -1;
320 }
321 bool isOpen = false;
322 if (OpenLocalGeoDatabase())
323 isOpen = true;
324 TSQLResult* resQ = nullptr;
325 TSQLRow* row = nullptr;
326 ostringstream stringStream;
327 // if (revision == nullptr)
328 stringStream << "select setup_id,status,material_id,field_id,file_name,modified_date from setup where lower(setup_tag)=lower('"
329 << setup_tag << "') order by creation_date desc;";
330 int sStatus = 0;
331 uint64_t sUpTime=0;
332 std::pair<int, uint64_t> status;
333 // else
334 // stringStream<<"select idsd,status,idma,idfi,rfile from setup where lower(stag)=lower('"<<setupTag<<"') and
335 // TRIM(revision)=TRIM('"<<revision<<"') order by sdate desc;";
336 if (isOpen) {
337 resQ = m_db->Query(stringStream.str().c_str());
338 if (resQ == nullptr) {
339 stringStream.str("");
340 stringStream << "select setup_id,status,material_id,field_id,file_name, creation_date from setup where lower(setup_tag)=lower('" << setup_tag
341 << "') order by creation_date desc;";
342 resQ = m_db->Query(stringStream.str().c_str());
343 if(resQ == nullptr)
344 LOG(error) << "SQL query was failed while searching the given tag: `" << setup_tag << "`. Setup will download from server.";
345 else
346 row = resQ->Next();
347 //return -2;
348 }
349 else
350 row = resQ->Next();
351 }
352 if (row != nullptr){
353 sStatus = atoi(row->GetField(1));
354 sUpTime = std::stoull(row->GetField(5), nullptr, 10);
355 }
356 if(sStatus==0){
357 status = CheckTagOnServer(setup_tag);
358 }
359 if (row == nullptr || (sStatus==0 && status.second>sUpTime)) {
360 LOG(error) << "No geometry setup found in the local database for `" << setup_tag << "` tag.";
361 delete resQ;
362 resQ = nullptr;
363 if(row!=nullptr){
364 delete row;
365 row = nullptr;
366 }
367 //int status
368 //std::pair<int, uint64_t> status = CheckTagOnServer(setup_tag);
369 if (status.first >= 0) {
370 int isUpload = -1;
371 if (status.first == 1) {
372 LOG(info) << "Approved geometry setup found on the geometry server:`" << GEO_SERVER_HOST
373 << "`. Downloading...";
374 isUpload = installLocalDB("");
375 } else {
376 LOG(info) << "Not approved geometry setup found on the geometry server:`" << GEO_SERVER_HOST
377 << "`. Downloading";
378 isUpload = installLocalDB(setup_tag);
379 }
380 if (isUpload >= 0) {
381 //In this case do not set modifined time for support old DB
382 stringStream.str("");
383 stringStream << "select setup_id,status,material_id,field_id,file_name from setup where lower(setup_tag)=lower('"
384 << setup_tag << "') order by creation_date desc;";
385 resQ = m_db->Query(stringStream.str().c_str());
386 row = resQ->Next();
387 } else {
388 LOG(error) << "Cannot download the geometry setup from the server:`" << GEO_SERVER_HOST << "`.";
389 return -2;
390 }
391 } else
392 LOG(error) << "No geometry setup found on the geometry server:`" << GEO_SERVER_HOST << "`.";
393 if (row == nullptr)
394 return -2;
395 }
396
397 m_sid = atoi(row->GetField(0));
398 // int idma = atoi(row->GetField(2));
399 m_fid = atoi(row->GetField(3));
400 TString geoFileName = GetRootPath() + row->GetField(4);
401 delete row;
402 delete resQ;
403
404 TFile* geoFile = new TFile(geoFileName, "READ");
405 if (!geoFile->IsOpen()) {
406 LOG(error) << "ERROR: could not open ROOT file with geometry: " + geoFileName;
407 return -3;
408 }
409 TList* keyList = geoFile->GetListOfKeys();
410 TIter next(keyList);
411 TKey* key = (TKey*)next();
412 TString className(key->GetClassName());
413 if (className.BeginsWith("TGeoManager"))
414 key->ReadObj();
415 else {
416 LOG(error) << "ERROR: TGeoManager is not top element in geometry file " + geoFileName;
417 return -3;
418 }
419 m_setupTag=setup_tag;
420 return 0;
421}
422
423// load selected geometry for simulation application from the Geometry Database.
424int GeoSetup::LoadSetupToFairRunSim(string_view setup_tag, const char* localSettings)
425{
426 if (localSettings != nullptr)
427 LoadLocalSettings(localSettings);
428
429 // int random_variable;
430 /* if (url != nullptr)
431 {
432 srand(time(NULL));
433 random_variable = rand();
434 //cout<<random_variable<<endl;
435 ostringstream stringStream;
436 // stringStream<<"wget -O test2.tar \""<<url<<"?type=s&tag="<<setupTag<<"&dirname="<<random_variable<<"\"";
437 http://cbmdb.jinr.ru/geometry8/download_file.php?type=all&tag=all stringStream<<"wget -O test2.tar
438 \""<<url<<"/download_file.php?type=all&tag=all&dirname="<<random_variable<<"\" >/dev/null ";
439 system(stringStream.str().c_str());
440
441 stringStream.str("");
442 stringStream<<"tar -xf test2.tar >/dev/null";
443 system(stringStream.str().c_str());
444
445 stringStream.str("");
446 stringStream<<"rm test2.tar";
447 system(stringStream.str().c_str());
448
449 stringStream.str("");
450 stringStream<<gSystem->pwd()<<"/"<<random_variable<<"/storage/";
451 gSystem->Setenv("DBL_ROOT_PATH", stringStream.str().c_str());
452
453 stringStream.str("");
454 stringStream<<gSystem->pwd()<<"/"<<random_variable<<"/local.db";
455 gSystem->Setenv("DBL_FILE_PATH", stringStream.str().c_str());
456 }*/
457 const char* env_p = getenv("DBL_FILE_PATH");
458 if (env_p == nullptr) {
459 LOG(error) << "Please, set DBL_FILE_PATH environment variable before using the Geometry Database";
460 return -1;
461 }
462 bool isOpen = false;
463 if (OpenLocalGeoDatabase())
464 isOpen = true;
465 TSQLResult* resQ = nullptr;
466 TSQLRow* row = nullptr;
467
468 ostringstream stringStream;
469 // if (revision == nullptr)
470 stringStream << "select setup_id,status,material_id,field_id,modified_date from setup where lower(setup_tag)=lower('" << setup_tag
471 << "') order by creation_date desc;"; // KG если я правильно понял, то нужно брать по-умолчанию,
472 // самый новый релиз?
473 // else
474 // stringStream<<"select idsd,status,idma,idfi from setup where stag='"<<setupTag<<"' and
475 // TRIM(revision)=TRIM('"<<revision<<"') order by sdate desc;";
476 LOG(debug1) << stringStream.str().c_str();
477 int sStatus = 0;
478 uint64_t sUpTime=0;
479 std::pair<int, uint64_t> status;
480 if (isOpen) {
481 resQ = m_db->Query(stringStream.str().c_str());
482 if (resQ == nullptr) {
483 //temprorary for support old versions
484 stringStream.str("");
485 stringStream << "select setup_id,status,material_id,field_id,creation_date from setup where lower(setup_tag)=lower('" << setup_tag
486 << "') order by creation_date desc;";
487 resQ = m_db->Query(stringStream.str().c_str());
488 if(resQ == nullptr)
489 LOG(error) << "SQL query was failed while searching the given tag: `" << setup_tag << "`. Setup will download from server.";
490 else
491 row = resQ->Next();
492 //return -2;
493 }
494 else
495 row = resQ->Next();
496 }
497 if (row != nullptr){
498 sStatus = atoi(row->GetField(1));
499 sUpTime = std::stoull(row->GetField(4), nullptr, 10);
500 }
501 if(sStatus==0){
502 status = CheckTagOnServer(setup_tag);
503 }
504 if (row == nullptr || (sStatus==0 && status.second>sUpTime)) {
505 LOG(error) << "No geometry setup found in the local database for `" << setup_tag << "` tag."<<status.first;
506 delete resQ;
507 resQ = nullptr;
508 if (status.first >= 0) {
509 int isUpload = -1;
510 if (status.first == 1) {
511 LOG(info) << "Approved geometry setup found on the geometry server:`" << GEO_SERVER_HOST
512 << "`. Downloading...";
513 isUpload = installLocalDB("");
514 } else {
515 LOG(info) << "Not approved geometry setup found on the geometry server:`" << GEO_SERVER_HOST
516 << "`. Downloading...";
517 isUpload = installLocalDB(setup_tag);
518 }
519 if (isUpload >= 0) {
520 //AE added for support old version
521 stringStream.str("");
522 stringStream << "select setup_id,status,material_id,field_id,file_name from setup where lower(setup_tag)=lower('"
523 << setup_tag << "') order by creation_date desc;";
524
525 resQ = m_db->Query(stringStream.str().c_str());
526 row = resQ->Next();
527 } else {
528 LOG(error) << "Cannot download the geometry setup from the server:`" << GEO_SERVER_HOST << "`.";
529 return -2;
530 }
531 } else
532 LOG(error) << "No geometry setup found on the geometry server:`" << GEO_SERVER_HOST << "`.";
533 if (row == nullptr)
534 return -2;
535 }
536
537 FairRunSim* fRun = FairRunSim::Instance();
538 if (fRun == nullptr) {
539 fRun = new FairRunSim();
540 LOG(info) << "New FairRunSim instance has been created";
541 }
542
543 m_sid = atoi(row->GetField(0));
544 int idma = atoi(row->GetField(2));
545 m_fid = atoi(row->GetField(3));
546 if (idma > 0) {
547 delete row;
548 delete resQ;
549
550 stringStream.str("");
551 stringStream << "select matag,file_name from material where material_id=" << idma << ";";
552 resQ = m_db->Query(stringStream.str().c_str());
553
554 if (resQ == 0 || resQ->GetRowCount() == 0)
555 LOG(info) << "Materials were not found";
556 else {
557 row = resQ->Next();
558 const char* media_path = row->GetField(1);
559
560 TString Mat = getenv("GEOMPATH");
561 if (Mat.IsNull()) {
562 Mat = ((TString)getenv("VMCWORKDIR")) + "/geometry/";
563 Mat.ReplaceAll("//", "/");
564 } else {
565 Mat.ReplaceAll("//", "/");
566 if (!Mat.EndsWith("/"))
567 Mat += "/";
568 }
569
570 string workP(Mat.Data());
571 LOG(debug1) << "Working geometry directory: " << workP;
572
573 size_t found = workP.find('/');
574 TString in("");
575 if (found != string::npos) {
576 while ((found = workP.find('/', found + 1)) != string::npos) {
577 LOG(debug1) << "found:" << found;
578 in += "../";
579 }
580 }
581 in += GetRootPath() + media_path;
582 // in= GetRootPath() + media_path;
583 fRun->SetMaterials(
584 in.Data()); // KG
585 // /home/soul/bmnroot/geometry/../../../..//home/soul/bmnroot/database/geo_db/storage/07022020_085550_media.geo?
586
587 delete row;
588 delete resQ;
589 }
590 } else {
591 delete row;
592 delete resQ;
593 }
594 LOG(info)<<"Load geometry with tag="<<setup_tag<<" from database";
595 LOG(debug1) << "setup_id = " << m_sid << "; material_id = " << idma << "; filed_id = " << m_fid << endl;
596 stringStream.str("");
597 stringStream << "select setup_module_id from sms where setup_id=" << m_sid << ";";
598 resQ = m_db->Query(stringStream.str().c_str());
599 if (resQ == 0 || resQ->GetRowCount() == 0) {
600 LOG(error) << "ERROR: no modules found";
601 return -3;
602 }
603 while ((row = resQ->Next()) != nullptr) {
604 stringStream.str("");
605 const char* idsm = row->GetField(0);
606 int idsmI = atoi(idsm);
607 LOG(debug1) << "module=" << idsmI << std::endl;
608 // if (subSetup < 0 || subSetup == idsmI){ //check subset
609 int res = LoadModuleToFairRunSim(idsmI, fRun);
610 if (res == -1) {
611 LOG(error) << "ERROR: no file for the setup module " << idsmI << " was found";
612 return -3;
613 }
614 delete row;
615 }
616 delete resQ;
617 for (const auto& item : m_moduleAdd) {
618 AddModuleToFairRunSim(item,fRun);
619 //std::cout << item << " ";
620 }
621
622 /* if (url != nullptr)
623 {
624 stringStream.str("");
625 stringStream<<"rm -rf "<<random_variable<<"/local.db";
626 system(stringStream.str().c_str());
627
628 stringStream.str("");
629 stringStream<<"rm -rf "<<random_variable;
630 system(stringStream.str().c_str());
631
632 cout<<"DBL_ROOT_PATH="<<getRootPath()<<endl; //KG should be DBL_PATH variables restored?
633 }*/
634 m_setupTag=setup_tag;
635 return 0;
636}
637
638// get field map of selected geometry
639FairField* GeoSetup::GetMagneticField(double scale)
640{
641 // return magnetic field if exists
642 if (m_field != nullptr)
643 return m_field;
644
645 if (m_db == nullptr) {
646 LOG(error) << "Geometry Database is not loaded";
647 return nullptr;
648 }
649 if (m_fid == -1) {
650 LOG(debug1) << "Selected Geometry Database has no magnetic field";
651 return nullptr;
652 }
653
654 // get field map for the current id from the Geometry Database
655 ostringstream stringStream;
656 stringStream << "select file_name,scale,x,y,z from field where field_id=" << m_fid << ";";
657 TSQLResult* resQ = m_db->Query(stringStream.str().c_str());
658 if (resQ == nullptr) {
659 LOG(error) << "SQL query was failed while searching magnetic field for id: `" << m_fid << "`";
660 return nullptr;
661 }
662 if (resQ->GetRowCount() == 0) {
663 LOG(error) << "ERROR: no selected magnetic field in the Geometry Database for id=" << m_fid;
664 delete resQ;
665 return nullptr;
666 }
667
668 TSQLRow* row = resQ->Next();
669 if (row == nullptr) {
670 LOG(error) << "ERROR: no selected magnetic field in the Geometry Database for id=" << m_fid;
671 delete resQ;
672 return nullptr;
673 }
674
675 // const char* url = row->GetField(0);
676 stringStream.str("");
677 stringStream << GetRootPath().c_str() << row->GetField(0);
678 if (access(stringStream.str().c_str(), F_OK) == -1) {
679 LOG(error) << "ERROR: File with the magnetic field was not found. The url=" << stringStream.str().c_str();
680 delete row;
681 delete resQ;
682 return nullptr;
683 }
684 double sc = atof(row->GetField(1));
685 delete row;
686 delete resQ;
687
688 // to be changed to dynamic magnetic class got by the Geometry Database
689 BmnNewFieldMap* pBmnNewFieldMap = new BmnNewFieldMap();
690 pBmnNewFieldMap->SetFileName(stringStream.str().c_str());
691 // scale the magnetic field
692 if (scale > 0)
693 pBmnNewFieldMap->SetScale(scale);
694 else
695 pBmnNewFieldMap->SetScale(sc);
696
697 m_field = pBmnNewFieldMap;
698 return m_field;
699}
700
701// get parameter file by given detector name
702string_view GeoSetup::GetParameterFile(string_view name)
703{
704 if (name == "") {
705 LOG(error) << "Detector name for the parameter file is not set";
706 return "";
707 }
708 if (m_db == nullptr) {
709 LOG(error) << "The Geometry Database is not connected";
710 return "";
711 }
712
713 TString sname(name);
714 int index = GetModuleIndex(sname);
715 if (index < 0) {
716 LOG(error) << "The detector name \'" << sname << "\'does not exist in the Geometry Database";
717 return "";
718 }
719 LOG(debug1) << "The detector name \'" << sname << "\'exists in the Geometry Database";
720
721 ostringstream stringStream;
722 stringStream
723 << "select sm.fpar from sms s INNER JOIN setup_module sm on s.idsm=sm.idsm INNER JOIN file f on sm.idf=f.idf "
724 "INNER JOIN module_revision mr on f.idm=mr.idmr where idsd="
725 << m_sid << " and mr.idm=" << index << ";";
726 LOG(debug1) << "Request \'" << stringStream.str().c_str() << "\'.";
727 TSQLResult* resQ = m_db->Query(stringStream.str().c_str());
728 if (resQ == nullptr) {
729 LOG(info) << "SQL query was failed while searching parameter file for detector `" << sname << "`";
730 return "";
731 }
732 TSQLRow* row = resQ->Next();
733 if (row == nullptr) {
734 LOG(info) << "Parameter file for detector `" << sname << "` not found";
735 return "";
736 }
737
738 const char* file = row->GetField(0);
739 delete row;
740 delete resQ;
741
742 if (file == nullptr) {
743 LOG(info) << "Parameter file for detector `" << sname << "` does not exist in the Geometry Database";
744 return "";
745 }
746
747 return file;
748}
749
750// get path to the location of the Local Geometry Database
751string GeoSetup::GetRootPath()
752{
753 string rootPath = gSystem->ExpandPathName(getenv("DBL_FILE_PATH"));
754
755 struct stat st;
756 if (stat(rootPath.c_str(), &st) == 0)
757 if ((st.st_mode & S_IFDIR) != 0) {
758 LOG(error) << "ERROR: DBL_FILE_PATH variable points to the folder. Please, set DBL_FILE_PATH to file path "
759 "with local geometry database";
760 return "";
761 }
762
763 int last = rootPath.find_last_of("/\\");
764 if (last == -1)
765 rootPath = ".";
766 else
767 rootPath = rootPath.substr(0, last);
768 rootPath += "/storage/";
769
770 return rootPath;
771}
772
773// get path to a temporary directory (/tmp/$USER/), and create if absent
774TString& GeoSetup::GetTmpPath()
775{
776 if (m_tmpFolder.Length() != 0)
777 return m_tmpFolder;
778
779 UserGroup_t* user = gSystem->GetUserInfo();
780 string login(user->fUser.Data());
781 m_tmpFolder = "/tmp/" + login + "/";
782 system("mkdir -p " + m_tmpFolder);
783
784 return m_tmpFolder;
785}
786
787// load local settings from the file for all setup modules
788bool GeoSetup::LoadLocalSettings(const char* fileName)
789{
790 LOG(info)<<"Load local settings of geometry DB from '"<<fileName<<"'";
791 TXMLEngine* xml = new TXMLEngine;
792 XMLDocPointer_t xmldoc = xml->ParseFile(fileName);
793 if (xmldoc == 0) {
794 LOG(error) << "Selected file has not XML format: " << fileName;
795 delete xml;
796 return false;
797 }
798
799 m_moduleEdit.clear();
800
801 XMLNodePointer_t mainnode = xml->DocGetRootElement(xmldoc);
802 XMLNodePointer_t child = xml->GetChild(mainnode);
803 while (child != 0) {
804 TString chName = xml->GetNodeName(child);
805 if (chName.CompareTo("editSetupModule") == 0) {
806 setup_module_ptr sNode = new setup_module();
807 sNode->xMove = 0;
808 sNode->yMove = 0;
809 sNode->zMove = 0;
810 sNode->enable = true;
811 sNode->type = TString("");
812
813 XMLAttrPointer_t attr = xml->GetFirstAttr(child);
814 while (attr != 0) {
815 TString aName = xml->GetAttrName(attr);
816 TString aValue = xml->GetAttrValue(attr);
817 if (aName.CompareTo("tag") == 0){
818 aValue.ToUpper();
819 sNode->type = aValue;
820 }
821 else if (aName.CompareTo("moveX") == 0) {
822 sNode->xMove = aValue.Atof();
823 } else if (aName.CompareTo("moveY") == 0) {
824 sNode->yMove = aValue.Atof();
825 } else if (aName.CompareTo("moveZ") == 0) {
826 sNode->zMove = aValue.Atof();
827 }
828 else if (aName.CompareTo("file_path") == 0){
829 gSystem->ExpandPathName(aValue);
830 sNode->file_path = aValue;
831 }
832 else if ((aName.CompareTo("enable") == 0)
833 && (aValue.CompareTo("false") == 0 || aValue.CompareTo("False") == 0
834 || aValue.CompareTo("FALSE") == 0))
835 sNode->enable = false;
836
837 LOG(debug1) << "attr: " << xml->GetAttrName(attr) << " value: " << xml->GetAttrValue(attr);
838
839 attr = xml->GetNextAttr(attr);
840 }
841
842 //int ii = GetModuleIndex(sNode->type);
843 //if(!sNode->enable)
844 // LOG(info)<<"Disable module with tag="<<sNode->type;//<<" and ModuleId="<<ii;
845 m_moduleEdit.insert(pair<TString, setup_module_ptr>(sNode->type, sNode));
846 } else if(chName.CompareTo("addModule") == 0){
847 module_r_ptr module = new module_r();
848 XMLAttrPointer_t attr = xml->GetFirstAttr(child);
849 while (attr != 0) {
850 TString aName = xml->GetAttrName(attr);
851 TString aValue = xml->GetAttrValue(attr);
852 if (aName.CompareTo("class_name") == 0)
853 module->class_name = aValue;
854 else if (aName.CompareTo("file_path") == 0){
855 gSystem->ExpandPathName(aValue);
856 module->file_path = aValue;
857 }
858 else if (aName.CompareTo("args") == 0)
859 module->args = aValue;
860 if ((aName.CompareTo("active") == 0)
861 && (aValue.CompareTo("false") == 0 || aValue.CompareTo("False") == 0
862 || aValue.CompareTo("FALSE") == 0))
863 module->active = false;
864 attr = xml->GetNextAttr(attr);
865 }
866 m_moduleAdd.push_back(module);
867 }
868 child = xml->GetNext(child);
869 }
870
871 xml->FreeDoc(xmldoc);
872 delete xml;
873 return true;
874}
875
876// get module name by index; return "Unknown" if not found
877TString GeoSetup::GetModuleName(int dbModuleUndex)
878{
879 map<int, TString>::iterator it = m_modules_table.find(dbModuleUndex);
880 if (it != m_modules_table.end())
881 return it->second;
882 else {
883 LOG(error) << "Unknown module type with id=" << dbModuleUndex;
884 return TString("Unknown");
885 }
886}
887
888// get module index by name; return -1 if not found
889int GeoSetup::GetModuleIndex(TString& name)
890{
891 map<int, TString>::iterator it;
892 for (it = m_modules_table.begin(); it != m_modules_table.end(); ++it)
893 if ((it->second).CompareTo(name, TString::ECaseCompare::kIgnoreCase) == 0)
894 return it->first;
895
896 return -1;
897}
898
899// get module_r_ptr (pointer to the module revision) by revision number
900module_r_ptr GeoSetup::GetModuleRevision(int dbModuleRev)
901{
902 map<int, module_r_ptr>::iterator it = m_modules_revision_table.find(dbModuleRev);
903 if (it != m_modules_revision_table.end())
904 return it->second; //.class_name;
905
906 module_r_ptr mr = nullptr;
907 return mr;
908}
909
910// get module ID by revision number; return -1 if not found
911int GeoSetup::GetModuleId(int dbModuleRev)
912{
913 map<int, module_r_ptr>::iterator it = m_modules_revision_table.find(dbModuleRev);
914 if (it != m_modules_revision_table.end())
915 return it->second->idm;
916
917 return -1;
918}
919
920// get module type by revision number
921TString GeoSetup::GetModuleType(int dbModuleRev)
922{
923 return GetModuleName(GetModuleId(dbModuleRev));
924}
925
926// get root volume in the TFile object (first search for TGeoManager)
927TGeoVolume* GeoSetup::GetRootVolume(TFile* f)
928{
929 TKey* key;
930 TGeoManager* geoManager = nullptr;
931 TList* l = f->GetListOfKeys();
932 TIter next(l);
933 while ((key = (TKey*)next())) {
934 if (strcmp(key->GetClassName(), "TGeoManager") != 0)
935 continue;
936 geoManager = (TGeoManager*)key->ReadObj();
937 geoManager->cd();
938 return (TGeoVolume*)geoManager->GetNode(0)->GetDaughter(0)->GetVolume();
939 }
940
941 // if TGeoManager was not found in the file
942 key = (TKey*)l->At(0); // Get the first key in the list
943 TGeoVolume* volume = dynamic_cast<TGeoVolume*>(key->ReadObj());
944
945 return volume;
946}
947
948// add FairModule defined by revision number and geometry file path to the FairRunSim instance
949bool GeoSetup::AddModuleToFairRunSim(int dbModuleRev, const char* path, FairRunSim* fRun)
950{
951 module_r_ptr mr = GetModuleRevision(dbModuleRev);
952
953 // TClass* cl = TClass::GetClass(mr->class_name);
954 // FairModule* f_cl = (FairModule*) cl->New();
955 // cout<<"TClass:"<<cl<<endl; f_cl->Dump();
956
957 TString type_name;
958 if (mr->args.Length() > 0) {
959 type_name = mr->args;
960 // f_cl->SetName(mr.args);
961 } else {
962 type_name = GetModuleType(dbModuleRev);
963 // f_cl->SetName(getModuleType(dbModuleRev));
964 }
965
966 TString command = "new " + mr->class_name + "(\"" + type_name + "\"";
967 if (mr->active)
968 command += ",kTRUE)";
969 else
970 command += ")";
971 LOG(debug1) << "command:" << command;
972
973 FairModule* obj = (FairModule*)gInterpreter->Calc(command);
974 // cerr<<"OBJ="<<obj<<endl; obj->Dump();
975 obj->SetGeometryFileName(path);
976 fRun->AddModule(obj);
977
978 // cerr<<"dbModuleRev="<<dbModuleRev<<" idmr="<<mr.idmr<<" idm="<<mr.idm<<" class_name="<<typeid(f_cl).name()<<endl;
979 return true;
980}
981bool GeoSetup::AddModuleToFairRunSim(module_r_ptr module, FairRunSim* fRun){
982 TString command= "new " + module->class_name + "(\"" + module->args + "\"";
983 if (module->active)
984 command += ",kTRUE)";
985 else
986 command += ")";
987 FairModule* obj = (FairModule*)gInterpreter->Calc(command);
988 obj->SetGeometryFileName(module->file_path);
989 fRun->AddModule(obj);
990 LOG(info)<<"\033[0;32mAdded external detector: file_path="<<module->file_path<<" class_name="<<module->class_name<<" isActive="<<module->active<<"\033[0m";
991 return true;
992}
993
994TGeoNode* GeoSetup::ConstructRootGeometry(const char* fileName)
995{
996 TGeoManager* NewGeo = 0;
997 TGeoVolume* volume = 0;
998 ;
999 TFile* f = new TFile(fileName);
1000 TList* l = f->GetListOfKeys();
1001 TKey* key;
1002 TIter next(l);
1003 TGeoNode* n = 0;
1004 // TGeoVolume* v1=0;
1005 while ((key = (TKey*)next())) {
1006 if (strcmp(key->GetClassName(), "TGeoManager") != 0) {
1007 continue;
1008 }
1009 NewGeo = (TGeoManager*)key->ReadObj();
1010 break;
1011 }
1012 if (NewGeo != 0) {
1013 NewGeo->cd();
1014 n = NewGeo->GetNode(0);
1015 f->Close();
1016 delete f;
1017 return n;
1018 } else {
1019 key = (TKey*)l->At(0); // Get the first key in the list
1020 volume = dynamic_cast<TGeoVolume*>(key->ReadObj());
1021 if (volume != 0) {
1022 f->Close();
1023 delete f;
1024 return volume->GetNode(0);
1025 } // n=volume->GetNode(0); }
1026 f->Close();
1027 delete f;
1028 return NULL;
1029 }
1030}
1031
1032bool GeoSetup::IsEqlMatrix(const char* fileName, TSQLRow* row)
1033{
1034 if (row == NULL || fileName == NULL)
1035 return false;
1036 bool res = true;
1037 try {
1038 // cerr<<"Start compare fileName:"<<fileName<<endl;
1039 TGeoNode* node = ConstructRootGeometry(fileName);
1040 if (node == NULL)
1041 return false;
1042 const Double_t* tran = node->GetMatrix()->GetTranslation(); // 3
1043 // const Double_t * sc = node->GetMatrix()->GetScale();//3
1044 const Double_t* rot = node->GetMatrix()->GetRotationMatrix(); // 9
1045 unsigned int i;
1046 for (i = 0; i < 3; i++) {
1047 double t = (double)atof(row->GetField(3 + i));
1048 if (tran[i] != t) {
1049 LOG(debug1) << " for i=" << i << " tran[i]=" << tran[i] << " t=" << t << endl;
1050 res = false;
1051 }
1052 }
1053 for (i = 0; i < 9; i++) {
1054 double t = (double)atof(row->GetField(6 + i));
1055 if (rot[i] != t) {
1056 LOG(debug1) << " for i=" << i << " rot[i]=" << rot[i] << " t=" << t << endl;
1057 res = false;
1058 }
1059 }
1060 } catch (...){
1061 return false;
1062 }
1063 return res;
1064}
1065// load one module from the Geometry Database and add to the FairRunSim instance
1066int GeoSetup::LoadModuleToFairRunSim(int idsm, FairRunSim* fRun)
1067{
1068 map<int, TString>::iterator it = m_loadedModule.find(idsm);
1069 if (it != m_loadedModule.end())
1070 return 0;
1071
1072 LOG(debug1) << "Start load idsm=" << idsm;
1073 LOG(debug1) << "Start load setup_module_id=" << idsm;
1074 ostringstream stringStream;
1075 stringStream << "select f.module_id,f.file_name,sm.parent_id,sm.tx,sm.ty,sm.tz,r11,r12,r13,r21,r22,r23,r31,r32,r33,sm.setup_module_tag "
1076 "from setup_module sm INNER JOIN geometry_file f ON f.file_id=sm.file_id where sm.setup_module_id="
1077 << idsm << ";";
1078 //cerr << stringStream.str() << endl;
1079
1080 TSQLResult* resQ = m_db->Query(stringStream.str().c_str());
1081 if (resQ == 0 || resQ->GetRowCount() == 0) {
1082 LOG(error) << "ERROR: no file for the setup module (" << idsm << ") was found";
1083 return -1;
1084 }
1085 // cerr<<"rows="<<resQ->GetRowCount()<<endl;
1086
1087 TSQLRow* row = resQ->Next();
1088 int dbModuleIndex = atoi(row->GetField(0));
1089 int idP = atoi(row->GetField(2));
1090 LOG(debug1) << "idP=" << idP;
1091 if (idP != -1) {
1092 int res = LoadModuleToFairRunSim(idP, fRun);
1093 if (res < 0)
1094 return res;
1095 }
1096
1097 stringStream.str("");
1098 LOG(debug1) << row->GetField(1);
1099 stringStream << GetRootPath().c_str() << row->GetField(1);
1100 // cerr<<"getRootPath()="<<GetRootPath().c_str()<<endl<<"File path="<<stringStream.str().c_str()<<endl;
1101
1102 TString mName = GetModuleType(dbModuleIndex), out = "";
1103 mName.ToUpper();
1104 bool isEnable=true;
1105 if (mName == TString("CAVE") || ((TString)stringStream.str()).EndsWith(".geo"))
1106 AddModuleToFairRunSim(dbModuleIndex, stringStream.str().c_str(), fRun);
1107 else {
1108 double mx = 0, my = 0, mz = 0;
1109 TString smTag=row->GetField(15);
1110 TString file_path=stringStream.str().c_str();
1111 smTag.ToUpper();
1112 map<TString, setup_module_ptr>::iterator itr = m_moduleEdit.find(smTag);
1113 LOG(debug1) << "detector " << dbModuleIndex;
1114 if (itr != m_moduleEdit.end()) {
1115 LOG(debug1) << "detector was found";
1116 isEnable=itr->second->enable;
1117 if (isEnable) {
1118 mx = itr->second->xMove;
1119 my = itr->second->yMove;
1120 mz = itr->second->zMove;
1121 if(itr->second->file_path.Length()>0)
1122 file_path=itr->second->file_path;
1123 LOG(debug1) << "Move detector " << dbModuleIndex << " to x:" << mx << " to y:" << my << " to z:" << mz;
1124 }
1125
1126 }
1127 if (isEnable && mx == 0 && my == 0 && mz == 0 && IsEqlMatrix(stringStream.str().c_str(), row)) {
1128 LOG(debug1) << "The same matrix for file=" << stringStream.str().c_str() << endl;
1129 LOG(info)<<"Loading module with tag="<<row->GetField(15);
1130 AddModuleToFairRunSim(dbModuleIndex, file_path, fRun);
1131 } else if(isEnable){
1132 TGeoManager* geom = new TGeoManager(mName, TString::Format("Geometry of the %s module", mName.Data()));
1133 LOG(debug1) << "import file" << file_path << endl;
1134 // TGeoManager::Import(stringStream.str().c_str());
1135 TFile* f = new TFile(file_path);
1136 TGeoVolume* root_volume = GetRootVolume(f);
1137 double tx = (double)atof(row->GetField(3)) + mx;
1138 double ty = (double)atof(row->GetField(4)) + my;
1139 double tz = (double)atof(row->GetField(5)) + mz;
1140 TGeoRotation rotM;
1141 TGeoGenTrans* newMatrix = new TGeoGenTrans(tx, ty, tz, 1, 1, 1, &rotM);
1142 if (strcmp(root_volume->GetNode(0)->ClassName(), "TGeoNodeMatrix") == 0) {
1143 TGeoNodeMatrix* v = (TGeoNodeMatrix*)root_volume->GetNode(0);
1144 // cerr<<"Matrix changed"<<endl;
1145 v->SetMatrix(newMatrix);
1146 }
1147
1148 // geom->CloseGeometry();
1149 out = GetTmpPath() + GetModuleName(GetModuleId(dbModuleIndex)) + ".root";
1150 root_volume->Export(out.Data());
1151 LOG(info)<<"Loading module with tag="<<row->GetField(15);
1152 // gGeoManager->Export(out.Data());
1153 AddModuleToFairRunSim(dbModuleIndex, out.Data(), fRun);
1154 LOG(debug1) << "Exporting geometry to ROOT file: " << out;
1155
1156 delete geom;
1157 f->Close();
1158 delete f;
1159 }
1160 else
1161 LOG(info)<<"\033[0;31mDisable module with tag="<<row->GetField(15)<<" use local settings.\033[0m";
1162 }
1163 m_loadedModule.insert(pair<int, TString>(idsm, out));
1164
1165 delete row;
1166 delete resQ;
1167 return 0;
1168}
1169
1170// fill table with modules (m_modules_table) from the Geometry Database
1171int GeoSetup::PutModules()
1172{
1173 TSQLResult* resQ = m_db->Query("select module_id,module_name from module;");
1174 if (resQ == nullptr) {
1175 LOG(error) << "ERROR: SQL query was failed. Please, check connection to the Geometry Database and "
1176 "DBL_FILE_PATH variable is correct";
1177 return -1;
1178 }
1179 if (resQ->GetRowCount() == 0) {
1180 LOG(error) << "ERROR: no modules in the Geometry Database";
1181 delete resQ;
1182 return -2;
1183 }
1184
1185 TSQLRow* row;
1186 while ((row = resQ->Next()) != 0) {
1187 int id = atoi(row->GetField(0));
1188 TString name(row->GetField(1));
1189 m_modules_table.insert(make_pair(id, name));
1190 delete row;
1191 }
1192
1193 delete resQ;
1194 return 0;
1195}
1196
1197// fill table with module revisions (m_modules_revision_table) from the Geometry Database
1198int GeoSetup::PutModuleRevisions()
1199{
1200 TSQLResult* resQ = m_db->Query("select module_class_id,mc.module_id,class_name,revision,active,object_name from "
1201 "module_class as mc INNER JOIN module as m ON mc.module_id=m.module_id;");
1202 if (resQ == nullptr) {
1203 LOG(error) << "ERROR: SQL query was failed. Please, check connection to the Geometry Database and "
1204 "DBL_FILE_PATH variable is correct";
1205 return -1;
1206 }
1207 if (resQ->GetRowCount() == 0) {
1208 LOG(error) << "ERROR: no module revisions in the geometry database";
1209 delete resQ;
1210 return -2;
1211 }
1212
1213 TSQLRow* row;
1214 while ((row = resQ->Next()) != 0) {
1215 module_r_ptr mr = new module_r();
1216 mr->idmr = atoi(row->GetField(0));
1217 mr->idm = atoi(row->GetField(1));
1218 mr->class_name = row->GetField(2);
1219 mr->rev = atoi(row->GetField(3));
1220 if (atoi(row->GetField(4)) == 0)
1221 mr->active = false;
1222 else
1223 mr->active = true;
1224 mr->args = row->GetField(5);
1225
1226 m_modules_revision_table.insert(make_pair(mr->idmr, mr));
1227 delete row;
1228 }
1229
1230 delete resQ;
1231 return 0;
1232}
bool ichar_equals(char a, char b)
Definition GeoSetup.cxx:32
__m128 v
Definition P4_F32vec4.h:1
int i
Definition P4_F32vec4.h:22
float f
Definition P4_F32vec4.h:21
void SetFileName(const char *map_file_name)
Definition BmnFieldMap.h:65
void SetScale(Double_t factor)
Definition BmnFieldMap.h:55
int LoadSetupToGeoManager(string_view setup_tag)
Definition GeoSetup.cxx:314
FairField * GetMagneticField(double scale=0)
Definition GeoSetup.cxx:639
string_view GetParameterFile(string_view detector_name)
Definition GeoSetup.cxx:702
string_view GetLastApprovedSetupTag(string_view tag_prefix)
Definition GeoSetup.cxx:55
int LoadSetupToFairRunSim(string_view setupTag, const char *localSettings=nullptr)
Definition GeoSetup.cxx:424
const char *const GEO_SERVER_HOST
struct SETUPMODULE setup_module
struct MODULEREVISION module_r
name
Definition setup.py:7
TString class_name
Definition GeoSetup.h:29
TString args
Definition GeoSetup.h:32
TString file_path
Definition GeoSetup.h:33
TString type
Definition GeoSetup.h:21
double zMove
Definition GeoSetup.h:22
TString file_path
Definition GeoSetup.h:24
double xMove
Definition GeoSetup.h:22
double yMove
Definition GeoSetup.h:22
bool enable
Definition GeoSetup.h:23