ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonDetDescr
MuonGMdbObjects
src
DblQ00Aszt.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/***************************************************************************
6
DB data - Muon Station components
7
-----------------------------------------
8
***************************************************************************/
9
10
#include "
MuonGMdbObjects/DblQ00Aszt.h
"
11
#include "
RDBAccessSvc/IRDBRecordset.h
"
12
#include "
RDBAccessSvc/IRDBAccessSvc.h
"
13
#include "
RDBAccessSvc/IRDBRecord.h
"
14
15
#include <algorithm>
16
#include <iostream>
17
#include <fstream>
18
#include <cstdlib>
19
20
namespace
MuonGM
{
21
22
DblQ00Aszt::DblQ00Aszt
(
IRDBAccessSvc
*pAccessSvc,
const
std::string & GeoTag,
const
std::string & GeoNode){
23
24
IRDBRecordset_ptr
aszt = pAccessSvc->
getRecordsetPtr
(
getName
(),GeoTag, GeoNode);
25
26
if
(aszt->
size
()>0) {
27
m_nObj
= aszt->
size
();
28
m_d
.resize (
m_nObj
);
29
if
(
m_nObj
== 0) std::cerr<<
"NO Aszt banks in the MuonDD Database"
<<std::endl;
30
31
for
(
size_t
i=0;i<aszt->
size
();++i) {
32
m_d
[i].version = (*aszt)[i]->getInt(
"VERS"
);
33
m_d
[i].line = (*aszt)[i]->getInt(
"LINE"
);
34
m_d
[i].jff = (*aszt)[i]->getInt(
"JFF"
);
35
m_d
[i].jzz = (*aszt)[i]->getInt(
"JZZ"
);
36
m_d
[i].job = (*aszt)[i]->getInt(
"JOB"
);
37
m_d
[i].tras = (*aszt)[i]->getFloat(
"TRAS"
);
38
m_d
[i].traz = (*aszt)[i]->getFloat(
"TRAZ"
);
39
m_d
[i].trat = (*aszt)[i]->getFloat(
"TRAT"
);
40
m_d
[i].rots = (*aszt)[i]->getFloat(
"ROTS"
);
41
m_d
[i].rotz = (*aszt)[i]->getFloat(
"ROTZ"
);
42
m_d
[i].rott = (*aszt)[i]->getFloat(
"ROTT"
);
43
m_d
[i].i = (*aszt)[i]->getInt(
"I"
);
44
m_d
[i].type = (*aszt)[i]->getString(
"TYP"
);
45
}
46
}
else
{
47
std::cerr<<
"NO Aszt banks in the MuonDD Database"
<<std::endl;
48
}
49
}
50
51
DblQ00Aszt::DblQ00Aszt
(
const
std::string& asciiFileName) {
52
53
std::cerr<<
"Aszt with asciiFileName = : <"
<<asciiFileName<<
"> "
<<std::endl;
54
// open file and count number of lines
55
m_nObj
=0;
56
std::ifstream asztFile(asciiFileName.c_str());
57
if
(!asztFile.is_open())
58
std::cerr<<
" bad ascii file: "
<<asciiFileName<<std::endl;
59
60
61
m_nObj
= std::count(std::istreambuf_iterator<char>(asztFile),
62
std::istreambuf_iterator<char>(),
'\n'
);
63
std::cout<<
"Number of lines in the A-line file <"
<<asciiFileName<<
"> is "
<<
m_nObj
<<std::endl;
64
65
66
m_d
.resize (
m_nObj
);
67
if
(
m_nObj
== 0) std::cerr<<
"NO Aszt banks in "
<<asciiFileName<<std::endl;
68
69
int
j=0;
70
71
// close and reopen file for input
72
asztFile.close();
73
asztFile.open(asciiFileName.c_str());
74
75
char
AlineMarker;
76
while
( asztFile
77
>> AlineMarker
78
>>
m_d
[j].
type
79
>>
m_d
[j].jff
80
>>
m_d
[j].jzz
81
>>
m_d
[j].job
82
>>
m_d
[j].tras
83
>>
m_d
[j].traz
84
>>
m_d
[j].trat
85
>>
m_d
[j].rots
86
>>
m_d
[j].rotz
87
>>
m_d
[j].rott
88
)
89
{
90
m_d
[j].line = j+1;
91
m_d
[j].tras = 0.1*
m_d
[j].tras;
// ProcessAlignments expects cm !
92
m_d
[j].traz = 0.1*
m_d
[j].traz;
// ProcessAlignments expects cm !
93
m_d
[j].trat = 0.1*
m_d
[j].trat;
// ProcessAlignments expects cm !
94
j++;
95
}
96
97
98
if
(j!=(
int
)
m_nObj
) {
99
std::cerr<<
"problem with DblQ00Aszt: j="
<<j<<
" m_nObj="
<<(int)
m_nObj
<<std::endl;
100
}
101
}
102
103
void
DblQ00Aszt::WriteAsztToAsciiFile
(
const
std::string& filename)
104
{
105
std::ofstream asztFile;
106
asztFile.open(filename.c_str());
107
for
(
int
j=0;j<(int)
m_nObj
;j++) {
108
asztFile
109
<<
"A "
110
<<
m_d
[j].type <<
" "
111
<<
m_d
[j].jff <<
" "
112
<<
m_d
[j].jzz <<
" "
113
<<
m_d
[j].job <<
" "
114
<<
m_d
[j].tras*10. <<
" "
// here mm !
115
<<
m_d
[j].traz*10. <<
" "
// here mm !
116
<<
m_d
[j].trat*10. <<
" "
// here mm !
117
<<
m_d
[j].rots <<
" "
118
<<
m_d
[j].rotz <<
" "
119
<<
m_d
[j].rott <<
" "
120
<<
"\n"
;
121
}
122
asztFile.close();
123
}
124
125
}
// end of namespace MuonGM
DblQ00Aszt.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition
IRDBAccessSvc.h:30
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition
IRDBAccessSvc.h:45
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(std::string_view node, std::string_view tag, std::string_view tag2node="", std::string_view connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
IRDBRecordset::size
virtual unsigned int size() const =0
MuonGM::DblQ00Aszt::getName
std::string getName() const
Definition
DblQ00Aszt.h:55
MuonGM::DblQ00Aszt::WriteAsztToAsciiFile
void WriteAsztToAsciiFile(const std::string &filename)
Definition
DblQ00Aszt.cxx:103
MuonGM::DblQ00Aszt::m_nObj
unsigned int m_nObj
Definition
DblQ00Aszt.h:61
MuonGM::DblQ00Aszt::DblQ00Aszt
DblQ00Aszt()=default
MuonGM::DblQ00Aszt::m_d
std::vector< ASZT > m_d
Definition
DblQ00Aszt.h:60
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition
GeoMuonHits.h:27
type
Generated on
for ATLAS Offline Software by
1.17.0