17 m_structuresFromFlags(),
25 m_outFileName =
"Out.AmdcOracle.AM." + m_outFileType +
"temp.data";
26 m_outPREsqlName =
"Out.AmdcOracle.AM." + m_outFileType +
".PREsql";
28 if (m_DBFileName.empty()) {
29 m_DBFileName =
"Generated_" + m_outFileType +
"_pool.txt";
40 return StatusCode::SUCCESS;
52 controller->UseGeoModelDetector(
"Muon");
58 for (
const auto &structure: m_structuresFromFlags) {
66 controller->ParseFiles();
71 std::string AGDDfile=theHelper.
GetAGDD(m_dumpAGDD, m_outFileType, m_DBFileName);
72 if( AGDDfile.empty() ) {
73 ATH_MSG_ERROR(
"\t-- empty AGDDfile - this cannot be correct " );
74 return StatusCode::FAILURE;
76 controller->ParseString(AGDDfile);
79 if (m_printSections) {
81 controller->PrintSections();
86 if (!m_readAGDD && !m_writeDBfile) {
87 for (
const auto &vol:m_volumesToBuild) {
88 controller->GetBuilder()->BuildFromVolume(vol);
92 for (
const auto &structure: m_structuresFromFlags) {
93 if (!m_buildNSW && structure==
"NewSmallWheel")
continue;
94 controller->GetBuilder()->BuildFromVolume(structure);
102 ATH_MSG_INFO(
"\t-- attempting to write output to "<< m_outFileName );
103 if( !m_outFileName.empty() )
105 if(!controller->WriteAGDDtoDBFile( m_outFileName ))
107 ATH_MSG_ERROR(
"\t-- something went wrong during writing AGDD file - crashing" );
108 return StatusCode::FAILURE;
111 ATH_MSG_INFO(
"\t-- AGDD successfully dumped to "<< m_outFileName);
113 if( !WritePREsqlFile() )
115 ATH_MSG_ERROR(
"\t-- something went wrong during writing PREsql file - crashing" );
116 return StatusCode::FAILURE;
119 ATH_MSG_INFO(
"\t-- AGDD successfully wrote PREsql file "<< m_outPREsqlName);
123 ATH_MSG_ERROR(
"\t-- no output file name provided - crashing " );
124 return StatusCode::FAILURE;
130 return StatusCode::SUCCESS;
136 std::ifstream
outfile(
m_outFileName.value().c_str(), std::ifstream::in | std::ifstream::binary);
138 std::vector<std::string> newoutfilelines;
139 std::string outfileline;
140 while( getline(
outfile, outfileline) )
141 if( outfileline !=
"\n" && outfileline !=
"\r" && !outfileline.empty() )
143 const auto strBegin = outfileline.find_first_not_of(
" \t");
144 const auto strEnd = outfileline.find_last_not_of(
" \t");
145 const auto strRange = strEnd - strBegin + 1;
146 if (strBegin != std::string::npos) outfileline = outfileline.substr(strBegin, strRange);
147 newoutfilelines.push_back(outfileline);
152 for(
auto it = newoutfilelines.begin();
it != newoutfilelines.end(); ++
it)
154 if(
it != newoutfilelines.begin()) newoutfile <<
"\n";
174 std::ofstream prefile;
176 prefile <<
"insert into AGDD_data (\n";
177 prefile <<
"AGDD_data_id,\n";
178 prefile <<
"VERS,\n";
179 prefile <<
"VNAME,\n";
180 prefile <<
"LENAGDD,\n";
181 prefile <<
"NLINE,\n";
183 prefile <<
") values (XXX_DATA_ID_KOUNTER,\n";
187 prefile << TheAmdcName.substr(0,4) <<
"'," << fileSize-1 <<
","<<
int( (fileSize + 2) / 4 )<<
",\n";
188 prefile <<
"empty_clob()\n";
190 prefile <<
"insert into AGDD_data2tag values (XXX_DATA2TAG_KOUNTER,XXX_DATA_ID_KOUNTER);\n";
191 prefile <<
"DECLARE\n";
192 prefile <<
" lobloc CLOB;\n";
193 prefile <<
" req utl_http.req;\n";
194 prefile <<
" resp utl_http.resp;\n";
195 prefile <<
" text VARCHAR2(32767);\n";
196 prefile <<
" amount INTEGER(10) := 0;\n";
197 prefile <<
" offset INTEGER(10) := 0;\n";
198 prefile <<
" TRUE BOOLEAN;\n";
199 prefile <<
"BEGIN\n";
200 prefile <<
" SELECT data INTO lobloc\n";
201 prefile <<
" FROM AGDD_data\n";
202 prefile <<
" WHERE AGDD_data_id = XXX_DATA_ID_KOUNTER FOR UPDATE;\n";
203 prefile <<
" offset := DBMS_LOB.GETLENGTH(lobloc)+2;\n";
204 prefile <<
" req := utl_http.begin_request(\n";
205 prefile <<
" 'WEB_ADDRESS_FOR_TEMP_DATA_FILEAGDDtemp.data');\n";
206 prefile <<
" resp := utl_http.get_response(req);\n";
207 prefile <<
" LOOP\n";
208 prefile <<
" text := ' ';\n";
209 prefile <<
" UTL_HTTP.READ_TEXT(resp, text, NULL);\n";
210 prefile <<
" /* DBMS_OUTPUT.PUT_LINE(text); */\n";
211 prefile <<
" amount := length(text);\n";
212 prefile <<
" DBMS_LOB.WRITEAPPEND(lobloc,amount,text);\n";
213 prefile <<
" END LOOP;\n";
214 prefile <<
" utl_http.end_response(resp);\n";
215 prefile <<
" EXCEPTION\n";
216 prefile <<
" WHEN utl_http.end_of_body\n";
217 prefile <<
" THEN utl_http.end_response(resp);\n";