ATLAS Offline Software
DblQ00IAcsc.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 
14 
15 #include <algorithm>
16 #include <iostream>
17 #include <fstream>
18 #include <cstdlib>
19 
20 namespace MuonGM{
21 
22  DblQ00IAcsc::DblQ00IAcsc(IRDBAccessSvc *pAccessSvc, const std::string & GeoTag, const std::string & GeoNode) {
23 
24  IRDBRecordset_ptr iacsc = pAccessSvc->getRecordsetPtr(getName(),GeoTag, GeoNode);
25 
26  if(iacsc->size()>0) {
27 
28  m_nObj = iacsc->size();
29  m_d.resize (m_nObj);
30  if (m_nObj == 0) std::cerr<<"NO IAcsc banks in the MuonDD Database"<<std::endl;
31 
32  for (size_t i =0; i<iacsc->size(); ++i) {
33 
34  m_d[i].version = (*iacsc)[i]->getInt("VERS");
35  m_d[i].line = i;
36  m_d[i].jff = (*iacsc)[i]->getInt("JFF");
37  m_d[i].jzz = (*iacsc)[i]->getInt("JZZ");
38  m_d[i].job = (*iacsc)[i]->getInt("JOB");
39  m_d[i].wireLayer = (*iacsc)[i]->getInt("JLAY");
40  m_d[i].tras = 10.*(*iacsc)[i]->getFloat("TRAS"); // I lines in mm, but ISZT in cm
41  m_d[i].traz = 10.*(*iacsc)[i]->getFloat("TRAZ"); // I lines in mm, but ISZT in cm
42  m_d[i].trat = 10.*(*iacsc)[i]->getFloat("TRAT"); // I lines in mm, but ISZT in cm
43  m_d[i].rots = (*iacsc)[i]->getFloat("ROTS");
44  m_d[i].rotz = (*iacsc)[i]->getFloat("ROTZ");
45  m_d[i].rott = (*iacsc)[i]->getFloat("ROTT");
46  m_d[i].type = (*iacsc)[i]->getString("TYP");
47  }
48  }
49  else {
50  std::cerr<<"NO IAcsc banks in the MuonDD Database"<<std::endl;
51  }
52 }
53 
54 
55 DblQ00IAcsc::DblQ00IAcsc(const std::string& asciiFileName) {
56  std::cerr<<"IAcsc with asciiFileName = : <"<<asciiFileName<<"> "<<std::endl;
57  // open file and count number of lines
58  m_nObj=0;
59  std::ifstream iacscFile(asciiFileName.c_str());
60  if (!iacscFile.is_open())
61  std::cerr<<" bad ascii file: "<<asciiFileName<<std::endl;
62 
63 
64  m_nObj = std::count(std::istreambuf_iterator<char>(iacscFile),
65  std::istreambuf_iterator<char>(),'\n');
66  std::cout<<"Number of lines in the CSc Internal A-line file <"<<asciiFileName<<"> is "<< m_nObj <<std::endl;
67 
68 
69  m_d.resize (m_nObj);
70  if (m_nObj == 0) std::cerr<<"NO IAcsc banks in "<<asciiFileName<<std::endl;
71 
72  int j=0;
73 
74  // close and reopen file for input
75  iacscFile.close();
76  iacscFile.open(asciiFileName.c_str());
77 
78  char AlineMarker;
79  while ( iacscFile
80  >> AlineMarker
81  >> m_d[j].type
82  >> m_d[j].jff
83  >> m_d[j].jzz
84  >> m_d[j].job
85  >> m_d[j].wireLayer
86  >> m_d[j].tras
87  >> m_d[j].traz
88  >> m_d[j].trat
89  >> m_d[j].rots
90  >> m_d[j].rotz
91  >> m_d[j].rott
92  )
93  {
94  std::cout<<" IAcsc:: line "<<j+1<<" --- jtyp, jff, jzz, job, w-layer "<<m_d[j].type<<" "
95  <<m_d[j].jff<<" "<<m_d[j].jzz <<" "
96  <<m_d[j].job<<" "<<m_d[j].wireLayer <<std::endl;
97  m_d[j].line = j+1;
98  j++;
99  }
100 
101 
102  if (j!=(int)m_nObj) {
103  std::cerr<<"problem with DblQ00IAcsc: j="<<j<<" m_nObj="<<(int)m_nObj<<std::endl;
104  }
105 
106 }
107 
108 void DblQ00IAcsc::WriteIAcscToAsciiFile(const std::string& filename)
109 {
110  std::ofstream iacscFile;
111  iacscFile.open(filename.c_str());
112  for (int j=0;j<(int)m_nObj;j++) {
113  iacscFile
114  <<"A "
115  << m_d[j].type <<" "
116  << m_d[j].jff <<" "
117  << m_d[j].jzz <<" "
118  << m_d[j].job <<" "
119  << m_d[j].wireLayer <<" "
120  << m_d[j].tras <<" " // here mm !
121  << m_d[j].traz <<" " // here mm !
122  << m_d[j].trat <<" " // here mm !
123  << m_d[j].rots <<" "
124  << m_d[j].rotz <<" "
125  << m_d[j].rott <<" "
126  << "\n";
127  }
128  iacscFile.close();
129 }
130 
131 } // end of namespace MuonGM
MuonGM::DblQ00IAcsc::DblQ00IAcsc
DblQ00IAcsc()=default
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MuonGM::DblQ00IAcsc::WriteIAcscToAsciiFile
void WriteIAcscToAsciiFile(const std::string &filename)
Definition: DblQ00IAcsc.cxx:111
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
lumiFormat.i
int i
Definition: lumiFormat.py:92
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition: IRDBAccessSvc.h:45
MuonGM::DblQ00IAcsc::m_nObj
unsigned int m_nObj
Definition: DblQ00IAcsc.h:63
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
DblQ00IAcsc.h
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
MuonGM::DblQ00IAcsc::m_d
std::vector< IACSC > m_d
Definition: DblQ00IAcsc.h:62
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
test_interactive_athena.job
job
Definition: test_interactive_athena.py:6
MuonGM::DblQ00IAcsc::getName
std::string getName() const
Definition: DblQ00IAcsc.h:57