10 string hd_msg =
" > MYSQL Detector Factory: >> ";
14 map<string, detector> dets;
30 string dname = it->first;
31 string tname = dname +
"__geometry";
35 int run = it->second.get_run_number();
38 cout << hd_msg <<
" Importing Detector: " << dname <<
" with <" <<
factoryType 39 <<
"> factory, variation \"" << variation <<
"\", run number: " << run << endl;
42 int last_id =
getLastId(db, tname, variation, run);
44 string dbexecute =
"select name, mother, description, pos, rot, col, type, ";
45 dbexecute +=
"dimensions, material, magfield, ncopy, pmany, exist, ";
46 dbexecute +=
"visible, style, sensitivity, hitType, identity from " + tname;
47 dbexecute +=
" where variation ='" + variation +
"'";
49 dbexecute +=
" and id = " +
stringify(last_id);
53 if(!q.exec(dbexecute.c_str()))
55 cout << hd_msg <<
" !!! Failed to execute MYSQL query " << dbexecute <<
". This is a fatal error. Exiting." << endl;
56 qDebug() << q.lastError();
62 cout <<
" ** WARNING: detector \"" << dname <<
"\" not found with variation \"" << variation <<
"\" for run number " << run << endl << endl;
72 for(
int i=0; i<18; i++)
84 if(dets.find(gt.
data[0]) != dets.end())
86 cout << endl <<
" *** WARNING! A detector >" << gt.
data[0] <<
" exists already. Keeping original, not loading this instance. " << endl << endl;
int check_if_factory_is_needed(map< string, detectorCondition > dcon, string factory)
void closeGdb(QSqlDatabase db)
QSqlDatabase openGdb(goptions gemcOpt)
int getLastId(QSqlDatabase db, string t, string v, int run)
string get_variation(string var)
parse variation name from string
void add_data(QVariant input)
map< string, detectorCondition > detectorConditionsMap
string stringify(double x)
map< string, aopt > optMap
Options map.
map< string, detector > loadDetectors()
bool is_main_variation(string var)
returns 1 if the string "main:" is found on the input
detector get_detector(gtable gt, goptions go, runConditions RC)