ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
MuonAGDDTool Class Reference

#include <MuonAGDDTool.h>

Inheritance diagram for MuonAGDDTool:
Collaboration diagram for MuonAGDDTool:

Public Member Functions

 MuonAGDDTool (const std::string &type, const std::string &name, const IInterface *parent)
 
 ~MuonAGDDTool ()=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

void BuildMuonSpectrometerFromFlags ()
 
bool WritePREsqlFile () const
 

Private Attributes

Gaudi::Property< bool > m_buildNSW {this,"BuildNSW",true}
 
Gaudi::Property< bool > m_overrideConfiguration {this,"OverrideConfiguration",false}
 
Gaudi::Property< std::vector< std::string > > m_structuresToBuild {this,"Structures",{}}
 
Gaudi::Property< std::string > m_outFileType {this,"OutputFileType","AGDD","Name for database table"}
 
Gaudi::Property< std::string > m_amdcName {this,"AmdcName","R.08","specify amdc name to be put into AGDD table (is overwritten by amdb layout name in case amdc blob is read)"}
 
std::vector< std::string > m_structuresFromFlags
 
std::string m_outPREsqlName
 

Detailed Description

Definition at line 11 of file MuonAGDDTool.h.

Constructor & Destructor Documentation

◆ MuonAGDDTool()

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

Definition at line 15 of file MuonAGDDTool.cxx.

15  :
18  m_outPREsqlName("")
19 {}

◆ ~MuonAGDDTool()

MuonAGDDTool::~MuonAGDDTool ( )
default

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/2]

virtual StatusCode construct MuonAGDDTool::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

Reimplemented from AGDDToolBase.

◆ ATLAS_NOT_THREAD_SAFE() [2/2]

virtual StatusCode initialize MuonAGDDTool::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

Reimplemented from AGDDToolBase.

◆ BuildMuonSpectrometerFromFlags()

void MuonAGDDTool::BuildMuonSpectrometerFromFlags ( )
private

◆ 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 }

◆ WritePREsqlFile()

bool MuonAGDDTool::WritePREsqlFile ( ) const
private

Definition at line 133 of file MuonAGDDTool.cxx.

134 {
135 
136  std::ifstream outfile(m_outFileName.value().c_str(), std::ifstream::in | std::ifstream::binary);
137 
138  std::vector<std::string> newoutfilelines;
139  std::string outfileline;
140  while( getline(outfile, outfileline) )
141  if( outfileline != "\n" && outfileline != "\r" && !outfileline.empty() )
142  {
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);
148  }
149  outfile.close();
150 
151  std::ofstream newoutfile(m_outFileName.value().c_str(), std::ofstream::out | std::ofstream::trunc);
152  for(auto it = newoutfilelines.begin(); it != newoutfilelines.end(); ++it)
153  {
154  if(it != newoutfilelines.begin()) newoutfile << "\n";
155  newoutfile << *it;
156  }
157  newoutfile.close();
158  outfile.open(m_outFileName.value().c_str(), std::ifstream::in | std::ifstream::binary);
159 
160  int fileSize = 0;
161  if(outfile.is_open())
162  {
163  outfile.seekg(0, std::ios::end);
164  fileSize = outfile.tellg();
165  outfile.close();
166  }
167  else {
168  ATH_MSG_ERROR("\t-- cannot get size of file " << m_outFileName );
169  return false;
170  }
171 
172  std::string TheAmdcName = m_amdcName;
173 
174  std::ofstream prefile;
175  prefile.open (m_outPREsqlName.c_str());
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";
182  prefile << "data\n";
183  prefile << ") values (XXX_DATA_ID_KOUNTER,\n";
184  // see constructor AmdcDbSvcMakerFromAmdc::AmdcDbSvcMakerFromAmdc
185  prefile << " 7,'";
186  // see method AmdcDbSvcMakerFromAmdc::AGDD (no idea why "-1", but it's needed to be consistent)
187  prefile << TheAmdcName.substr(0,4) <<"'," << fileSize-1 << ","<< int( (fileSize + 2) / 4 )<<",\n";
188  prefile << "empty_clob()\n";
189  prefile << ");\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";
218  prefile << "END;\n";
219  prefile << "/\n";
220  prefile.close();
221 
222  return true;
223 
224 }

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.

◆ m_amdcName

Gaudi::Property<std::string> MuonAGDDTool::m_amdcName {this,"AmdcName","R.08","specify amdc name to be put into AGDD table (is overwritten by amdb layout name in case amdc blob is read)"}
private

Definition at line 26 of file MuonAGDDTool.h.

◆ m_builderVerbosity

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

Definition at line 31 of file AGDDToolBase.h.

◆ m_buildNSW

Gaudi::Property<bool> MuonAGDDTool::m_buildNSW {this,"BuildNSW",true}
private

Definition at line 20 of file MuonAGDDTool.h.

◆ 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.

◆ m_defaultDetector

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

Definition at line 41 of file AGDDToolBase.h.

◆ m_disableSections

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

Definition at line 34 of file AGDDToolBase.h.

◆ m_dumpAGDD

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

Definition at line 38 of file AGDDToolBase.h.

◆ m_locked

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

Definition at line 35 of file AGDDToolBase.h.

◆ m_navigateDetector

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

Definition at line 42 of file AGDDToolBase.h.

◆ m_outFileName

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

Definition at line 40 of file AGDDToolBase.h.

◆ m_outFileType

Gaudi::Property<std::string> MuonAGDDTool::m_outFileType {this,"OutputFileType","AGDD","Name for database table"}
private

Definition at line 25 of file MuonAGDDTool.h.

◆ m_outPREsqlName

std::string MuonAGDDTool::m_outPREsqlName
private

Definition at line 29 of file MuonAGDDTool.h.

◆ m_overrideConfiguration

Gaudi::Property<bool> MuonAGDDTool::m_overrideConfiguration {this,"OverrideConfiguration",false}
private

Definition at line 21 of file MuonAGDDTool.h.

◆ m_parserVerbosity

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

Definition at line 30 of file AGDDToolBase.h.

◆ m_printSections

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

Definition at line 33 of file AGDDToolBase.h.

◆ m_readAGDD

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

Definition at line 37 of file AGDDToolBase.h.

◆ m_sectionsToBuild

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

Definition at line 27 of file AGDDToolBase.h.

◆ m_structuresFromFlags

std::vector<std::string> MuonAGDDTool::m_structuresFromFlags
private

Definition at line 28 of file MuonAGDDTool.h.

◆ m_structuresToBuild

Gaudi::Property<std::vector<std::string> > MuonAGDDTool::m_structuresToBuild {this,"Structures",{}}
private

Definition at line 23 of file MuonAGDDTool.h.

◆ m_svc

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

Definition at line 46 of file AGDDToolBase.h.

◆ m_volumesToBuild

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

Definition at line 28 of file AGDDToolBase.h.

◆ m_writeDBfile

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

Definition at line 36 of file AGDDToolBase.h.

◆ m_xmlFiles

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

Definition at line 26 of file AGDDToolBase.h.


The documentation for this class was generated from the following files:
MuonAGDDTool::m_outPREsqlName
std::string m_outPREsqlName
Definition: MuonAGDDTool.h:29
AGDDToolBase::m_sectionsToBuild
Gaudi::Property< std::vector< std::string > > m_sectionsToBuild
Definition: AGDDToolBase.h:27
AGDDToolBase::m_outFileName
Gaudi::Property< std::string > m_outFileName
Definition: AGDDToolBase.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CxxUtils::LockedPointer
A pointer together with a movable lock.
Definition: LockedPointer.h:35
skel.it
it
Definition: skel.GENtoEVGEN.py:396
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
MuonAGDDTool::m_structuresFromFlags
std::vector< std::string > m_structuresFromFlags
Definition: MuonAGDDTool.h:28
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
AGDDToolBase::m_locked
Gaudi::Property< bool > m_locked
Definition: AGDDToolBase.h:35
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
AGDDToolBase::m_volumesToBuild
Gaudi::Property< std::vector< std::string > > m_volumesToBuild
Definition: AGDDToolBase.h:28
MuonAGDDTool::m_amdcName
Gaudi::Property< std::string > m_amdcName
Definition: MuonAGDDTool.h:26
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AGDDToolBase::m_svc
ServiceHandle< IAGDDtoGeoSvc > m_svc
Definition: AGDDToolBase.h:47
AGDDToolBase::m_xmlFiles
Gaudi::Property< std::vector< std::string > > m_xmlFiles
Definition: AGDDToolBase.h:26
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AGDDToolBase::AGDDToolBase
AGDDToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: AGDDToolBase.cxx:8
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42