ATLAS Offline Software
Loading...
Searching...
No Matches
NSWAGDDTool Class Reference

#include <NSWAGDDTool.h>

Inheritance diagram for NSWAGDDTool:
Collaboration diagram for NSWAGDDTool:

Public Member Functions

 NSWAGDDTool (const std::string &type, const std::string &name, const IInterface *parent)
 ~NSWAGDDTool ()=default
virtual StatusCode construct ATLAS_NOT_THREAD_SAFE () override
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override

Protected Member Functions

void InitializeAGDD ()

Protected Attributes

Gaudi::Property< std::vector< std::string > > m_xmlFiles {this, "XMLFiles", {} }
Gaudi::Property< std::vector< std::string > > m_sectionsToBuild {this, "Sections", {} }
Gaudi::Property< std::vector< std::string > > m_volumesToBuild {this, "Volumes", {} }
Gaudi::Property< int > m_parserVerbosity {this, "ParserVerbosity", 0}
Gaudi::Property< int > m_builderVerbosity {this, "BuilderVerbosity", 0}
Gaudi::Property< bool > m_printSections {this, "PrintSections", false}
Gaudi::Property< bool > m_disableSections {this, "DisableSections", true}
Gaudi::Property< bool > m_locked {this, "Locked", false}
Gaudi::Property< bool > m_writeDBfile {this, "WriteAGDDFile", false}
Gaudi::Property< bool > m_readAGDD {this,"ReadAGDD",true,"read description from DB"}
Gaudi::Property< bool > m_dumpAGDD {this,"DumpAGDD",false,"write out parsed XML"}
Gaudi::Property< std::string > m_outFileName {this, "OutAGDDXMLName", "mytest.xml"}
Gaudi::Property< std::string > m_defaultDetector {this, "DefaultDetector", "NoDetector"}
Gaudi::Property< std::string > m_navigateDetector {this, "NavigateDetector", ""}
Gaudi::Property< std::string > m_DBFileName {this,"OutputFileName","","specify name for DB text file"}
Gaudi::Property< std::string > m_agdd2GeoSvcName {this,"AGDDtoGeoSvcName","AGDDtoGeoSvc","specify name of AGDDtoGeoSvc"}
ServiceHandle< IAGDDtoGeoSvcm_svc { this, "AGDDtoGeoSvc", "AGDDtoGeoSvc", "" }

Private Member Functions

bool WritePREsqlFile () const

Private Attributes

Gaudi::Property< int > m_outFileActV {this,"OutputFileACTVERS",0,"active version number"}
Gaudi::Property< int > m_outFileAlgV {this,"OutputFileALGVERS",0,"alignment version number"}
Gaudi::Property< int > m_outFilePasV {this,"OutputFilePASVERS",0,"passive structure version number"}
Gaudi::Property< std::string > m_outFileActN {this,"OutputFileACTVNAME","","active version string"}
Gaudi::Property< std::string > m_outFileAlgN {this,"OutputFileALGVNAME","","alignment version string"}
Gaudi::Property< std::string > m_outFilePasN {this,"OutputFilePASVNAME","","passive structure version string"}
Gaudi::Property< std::string > m_outFileForm {this,"OutputFileFORMAT","AGDDXML","format of output file"}
Gaudi::Property< std::string > m_outFileType {this,"OutputFileType","NSWD","name for database table"}
std::string m_outFileInName
std::string m_outPREsqlName

Detailed Description

Definition at line 10 of file NSWAGDDTool.h.

Constructor & Destructor Documentation

◆ NSWAGDDTool()

NSWAGDDTool::NSWAGDDTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 19 of file NSWAGDDTool.cxx.

19 :
20 AGDDToolBase(type,name,parent),
22 m_outPREsqlName("") {
23}
AGDDToolBase(const std::string &type, const std::string &name, const IInterface *parent)
std::string m_outPREsqlName
Definition NSWAGDDTool.h:30
std::string m_outFileInName
Definition NSWAGDDTool.h:29

◆ ~NSWAGDDTool()

NSWAGDDTool::~NSWAGDDTool ( )
default

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/2]

virtual StatusCode construct NSWAGDDTool::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

Reimplemented from AGDDToolBase.

◆ ATLAS_NOT_THREAD_SAFE() [2/2]

virtual StatusCode initialize NSWAGDDTool::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

Reimplemented from AGDDToolBase.

◆ InitializeAGDD()

void AGDDToolBase::InitializeAGDD ( )
protectedinherited

Definition at line 22 of file AGDDToolBase.cxx.

23{
24 ATH_MSG_INFO(" initializing AGDD builder");
25
26 IAGDDtoGeoSvc::LockedController controller = m_svc->getController();
27 controller->Locked(m_locked);
28
29 ATH_MSG_INFO(" XML file ");
30 for (unsigned int i=0;i<m_xmlFiles.size();i++)
31 {
32 ATH_MSG_INFO(" \t file "<<m_xmlFiles[i]);
33 controller->AddFile(m_xmlFiles[i]);
34 }
35 ATH_MSG_INFO (" ---------");
36
37
38 ATH_MSG_INFO(" Sections ");
39 for (unsigned int i=0;i<m_sectionsToBuild.size();i++)
40 {
41 ATH_MSG_INFO(" \t section "<<m_sectionsToBuild[i]);
42 controller->AddSection(m_sectionsToBuild[i]);
43 }
44 ATH_MSG_INFO (" ---------");
45
46
47 ATH_MSG_INFO(" Volumes ");
48 for (unsigned int i=0;i<m_volumesToBuild.size();i++)
49 {
50 ATH_MSG_INFO(" \t volume "<<m_volumesToBuild[i]);
51 controller->AddVolume(m_volumesToBuild[i]);
52 }
53 ATH_MSG_INFO (" ---------");
54
55}
#define ATH_MSG_INFO(x)
void Locked(bool b)
void AddFile(const std::string &fName)
void AddSection(const std::string &section)
void AddVolume(const std::string &volume)
ServiceHandle< IAGDDtoGeoSvc > m_svc
Gaudi::Property< std::vector< std::string > > m_xmlFiles
Gaudi::Property< std::vector< std::string > > m_volumesToBuild
Gaudi::Property< std::vector< std::string > > m_sectionsToBuild
Gaudi::Property< bool > m_locked
CxxUtils::LockedPointer< AGDDController > LockedController

◆ WritePREsqlFile()

bool NSWAGDDTool::WritePREsqlFile ( ) const
private

Definition at line 130 of file NSWAGDDTool.cxx.

131{
132
133 std::ifstream outfile(m_outFileName.value().c_str(), std::ifstream::in | std::ifstream::binary);
134
135 std::vector<std::string> newoutfilelines;
136 std::string outfileline;
137 while( getline(outfile, outfileline) )
138 if( outfileline != "\n" && outfileline != "\r" && !outfileline.empty() )
139 {
140 const auto strBegin = outfileline.find_first_not_of(" \t");
141 const auto strEnd = outfileline.find_last_not_of(" \t");
142 const auto strRange = strEnd - strBegin + 1;
143 if (strBegin != std::string::npos) outfileline = outfileline.substr(strBegin, strRange);
144 newoutfilelines.push_back(outfileline);
145 }
146 outfile.close();
147
148 std::ofstream newoutfile(m_outFileName.value().c_str(), std::ofstream::out | std::ofstream::trunc);
149 for(auto it = newoutfilelines.begin(); it != newoutfilelines.end(); ++it)
150 {
151 if(it != newoutfilelines.begin()) newoutfile << "\n";
152 newoutfile << *it;
153 }
154 newoutfile.close();
155 outfile.open(m_outFileName.value().c_str(), std::ifstream::in | std::ifstream::binary);
156
157 int fileSize = 0;
158 if(outfile.is_open())
159 {
160 outfile.seekg(0, std::ios::end);
161 fileSize = outfile.tellg();
162 outfile.close();
163 }
164 else {
165 ATH_MSG_ERROR("\t-- cannot get size of file " << m_outFileName );
166 return false;
167 }
168
169 std::ofstream prefile;
170 prefile.open (m_outPREsqlName.c_str());
171 prefile << "insert into NSWD_data (\n";
172 prefile << "NSWD_data_id,\n";
173 prefile << "ACTVERS,\n";
174 prefile << "ACTVNAME,\n";
175 prefile << "ALGVERS,\n";
176 prefile << "ALGVNAME,\n";
177 prefile << "PASVERS,\n";
178 prefile << "PASVNAME,\n";
179 prefile << "FORMAT,\n";
180 prefile << "FNAME,\n";
181 prefile << "LENNSW,\n";
182 prefile << "NLINE,\n";
183 prefile << "data\n";
184 prefile << ") values (XXX_DATA_ID_KOUNTER,\n";
185 prefile << m_outFileActV << ",'" << m_outFileActN << "',";
186 prefile << m_outFileAlgV << ",'" << m_outFileAlgN << "',";
187 prefile << m_outFilePasV << ",'" << m_outFilePasN << "',\n";
188 prefile << "'" << m_outFileForm <<"','" << m_outFileInName << "',"<< fileSize-1 << ","<< int( (fileSize + 2) / 4 )<<",\n";
189 prefile << "empty_clob()\n";
190 prefile << ");\n";
191 prefile << "insert into NSWD_data2tag values (XXX_DATA2TAG_KOUNTER,XXX_DATA_ID_KOUNTER);\n";
192 prefile << "DECLARE\n";
193 prefile << " lobloc CLOB;\n";
194 prefile << " req utl_http.req;\n";
195 prefile << " resp utl_http.resp;\n";
196 prefile << " text VARCHAR2(32767);\n";
197 prefile << " amount INTEGER(10) := 0;\n";
198 prefile << " offset INTEGER(10) := 0;\n";
199 prefile << " TRUE BOOLEAN;\n";
200 prefile << "BEGIN\n";
201 prefile << " SELECT data INTO lobloc\n";
202 prefile << " FROM NSWD_data\n";
203 prefile << " WHERE NSWD_data_id = XXX_DATA_ID_KOUNTER FOR UPDATE;\n";
204 prefile << " offset := DBMS_LOB.GETLENGTH(lobloc)+2;\n";
205 prefile << " req := utl_http.begin_request(\n";
206 prefile << " 'WEB_ADDRESS_FOR_TEMP_DATA_FILENSWDtemp.data');\n";
207 prefile << " resp := utl_http.get_response(req);\n";
208 prefile << " LOOP\n";
209 prefile << " text := ' ';\n";
210 prefile << " UTL_HTTP.READ_TEXT(resp, text, NULL);\n";
211 prefile << " /* DBMS_OUTPUT.PUT_LINE(text); */\n";
212 prefile << " amount := length(text);\n";
213 prefile << " DBMS_LOB.WRITEAPPEND(lobloc,amount,text);\n";
214 prefile << " END LOOP;\n";
215 prefile << " utl_http.end_response(resp);\n";
216 prefile << " EXCEPTION\n";
217 prefile << " WHEN utl_http.end_of_body\n";
218 prefile << " THEN utl_http.end_response(resp);\n";
219 prefile << "END;\n";
220 prefile << "/\n";
221 prefile.close();
222
223 return true;
224
225}
#define ATH_MSG_ERROR(x)
Gaudi::Property< std::string > m_outFileName
Gaudi::Property< int > m_outFileActV
Definition NSWAGDDTool.h:19
Gaudi::Property< std::string > m_outFileActN
Definition NSWAGDDTool.h:23
Gaudi::Property< int > m_outFileAlgV
Definition NSWAGDDTool.h:20
Gaudi::Property< std::string > m_outFileAlgN
Definition NSWAGDDTool.h:24
Gaudi::Property< int > m_outFilePasV
Definition NSWAGDDTool.h:21
Gaudi::Property< std::string > m_outFileForm
Definition NSWAGDDTool.h:26
Gaudi::Property< std::string > m_outFilePasN
Definition NSWAGDDTool.h:25

Member Data Documentation

◆ m_agdd2GeoSvcName

Gaudi::Property<std::string> AGDDToolBase::m_agdd2GeoSvcName {this,"AGDDtoGeoSvcName","AGDDtoGeoSvc","specify name of AGDDtoGeoSvc"}
protectedinherited

Definition at line 44 of file AGDDToolBase.h.

44{this,"AGDDtoGeoSvcName","AGDDtoGeoSvc","specify name of AGDDtoGeoSvc"};

◆ m_builderVerbosity

Gaudi::Property<int> AGDDToolBase::m_builderVerbosity {this, "BuilderVerbosity", 0}
protectedinherited

Definition at line 31 of file AGDDToolBase.h.

31{this, "BuilderVerbosity", 0};

◆ m_DBFileName

Gaudi::Property<std::string> AGDDToolBase::m_DBFileName {this,"OutputFileName","","specify name for DB text file"}
protectedinherited

Definition at line 43 of file AGDDToolBase.h.

43{this,"OutputFileName","","specify name for DB text file"};

◆ m_defaultDetector

Gaudi::Property<std::string> AGDDToolBase::m_defaultDetector {this, "DefaultDetector", "NoDetector"}
protectedinherited

Definition at line 41 of file AGDDToolBase.h.

41{this, "DefaultDetector", "NoDetector"};

◆ m_disableSections

Gaudi::Property<bool> AGDDToolBase::m_disableSections {this, "DisableSections", true}
protectedinherited

Definition at line 34 of file AGDDToolBase.h.

34{this, "DisableSections", true};

◆ m_dumpAGDD

Gaudi::Property<bool> AGDDToolBase::m_dumpAGDD {this,"DumpAGDD",false,"write out parsed XML"}
protectedinherited

Definition at line 38 of file AGDDToolBase.h.

38{this,"DumpAGDD",false,"write out parsed XML"};

◆ m_locked

Gaudi::Property<bool> AGDDToolBase::m_locked {this, "Locked", false}
protectedinherited

Definition at line 35 of file AGDDToolBase.h.

35{this, "Locked", false};

◆ m_navigateDetector

Gaudi::Property<std::string> AGDDToolBase::m_navigateDetector {this, "NavigateDetector", ""}
protectedinherited

Definition at line 42 of file AGDDToolBase.h.

42{this, "NavigateDetector", ""};

◆ m_outFileActN

Gaudi::Property<std::string> NSWAGDDTool::m_outFileActN {this,"OutputFileACTVNAME","","active version string"}
private

Definition at line 23 of file NSWAGDDTool.h.

23{this,"OutputFileACTVNAME","","active version string"};

◆ m_outFileActV

Gaudi::Property<int> NSWAGDDTool::m_outFileActV {this,"OutputFileACTVERS",0,"active version number"}
private

Definition at line 19 of file NSWAGDDTool.h.

19{this,"OutputFileACTVERS",0,"active version number"};

◆ m_outFileAlgN

Gaudi::Property<std::string> NSWAGDDTool::m_outFileAlgN {this,"OutputFileALGVNAME","","alignment version string"}
private

Definition at line 24 of file NSWAGDDTool.h.

24{this,"OutputFileALGVNAME","","alignment version string"};

◆ m_outFileAlgV

Gaudi::Property<int> NSWAGDDTool::m_outFileAlgV {this,"OutputFileALGVERS",0,"alignment version number"}
private

Definition at line 20 of file NSWAGDDTool.h.

20{this,"OutputFileALGVERS",0,"alignment version number"};

◆ m_outFileForm

Gaudi::Property<std::string> NSWAGDDTool::m_outFileForm {this,"OutputFileFORMAT","AGDDXML","format of output file"}
private

Definition at line 26 of file NSWAGDDTool.h.

26{this,"OutputFileFORMAT","AGDDXML","format of output file"};

◆ m_outFileInName

std::string NSWAGDDTool::m_outFileInName
private

Definition at line 29 of file NSWAGDDTool.h.

◆ m_outFileName

Gaudi::Property<std::string> AGDDToolBase::m_outFileName {this, "OutAGDDXMLName", "mytest.xml"}
protectedinherited

Definition at line 40 of file AGDDToolBase.h.

40{this, "OutAGDDXMLName", "mytest.xml"};

◆ m_outFilePasN

Gaudi::Property<std::string> NSWAGDDTool::m_outFilePasN {this,"OutputFilePASVNAME","","passive structure version string"}
private

Definition at line 25 of file NSWAGDDTool.h.

25{this,"OutputFilePASVNAME","","passive structure version string"};

◆ m_outFilePasV

Gaudi::Property<int> NSWAGDDTool::m_outFilePasV {this,"OutputFilePASVERS",0,"passive structure version number"}
private

Definition at line 21 of file NSWAGDDTool.h.

21{this,"OutputFilePASVERS",0,"passive structure version number"};

◆ m_outFileType

Gaudi::Property<std::string> NSWAGDDTool::m_outFileType {this,"OutputFileType","NSWD","name for database table"}
private

Definition at line 27 of file NSWAGDDTool.h.

27{this,"OutputFileType","NSWD","name for database table"};

◆ m_outPREsqlName

std::string NSWAGDDTool::m_outPREsqlName
private

Definition at line 30 of file NSWAGDDTool.h.

◆ m_parserVerbosity

Gaudi::Property<int> AGDDToolBase::m_parserVerbosity {this, "ParserVerbosity", 0}
protectedinherited

Definition at line 30 of file AGDDToolBase.h.

30{this, "ParserVerbosity", 0};

◆ m_printSections

Gaudi::Property<bool> AGDDToolBase::m_printSections {this, "PrintSections", false}
protectedinherited

Definition at line 33 of file AGDDToolBase.h.

33{this, "PrintSections", false};

◆ m_readAGDD

Gaudi::Property<bool> AGDDToolBase::m_readAGDD {this,"ReadAGDD",true,"read description from DB"}
protectedinherited

Definition at line 37 of file AGDDToolBase.h.

37{this,"ReadAGDD",true,"read description from DB"};

◆ m_sectionsToBuild

Gaudi::Property<std::vector<std::string> > AGDDToolBase::m_sectionsToBuild {this, "Sections", {} }
protectedinherited

Definition at line 27 of file AGDDToolBase.h.

27{this, "Sections", {} };

◆ m_svc

ServiceHandle<IAGDDtoGeoSvc> AGDDToolBase::m_svc { this, "AGDDtoGeoSvc", "AGDDtoGeoSvc", "" }
protectedinherited

Definition at line 46 of file AGDDToolBase.h.

47{ this, "AGDDtoGeoSvc", "AGDDtoGeoSvc", "" };

◆ m_volumesToBuild

Gaudi::Property<std::vector<std::string> > AGDDToolBase::m_volumesToBuild {this, "Volumes", {} }
protectedinherited

Definition at line 28 of file AGDDToolBase.h.

28{this, "Volumes", {} };

◆ m_writeDBfile

Gaudi::Property<bool> AGDDToolBase::m_writeDBfile {this, "WriteAGDDFile", false}
protectedinherited

Definition at line 36 of file AGDDToolBase.h.

36{this, "WriteAGDDFile", false};

◆ m_xmlFiles

Gaudi::Property<std::vector<std::string> > AGDDToolBase::m_xmlFiles {this, "XMLFiles", {} }
protectedinherited

Definition at line 26 of file AGDDToolBase.h.

26{this, "XMLFiles", {} };

The documentation for this class was generated from the following files: