3 #include <utl/AugerException.h>
8 using namespace TelescopeSimulatorLX ;
24 map<int,MIRRORPARAMS>::const_iterator iter;
27 for(
int i=0;i<ncnt;i++){
40 memset(&s_paramsNull,0,
sizeof(s_paramsNull));
59 char szbuff[512], szaux[32];
60 char szTelescopeFlag[4];
67 G4cerr <<
"cannot open file with mirror params: " <<
m_szFilename << G4endl;
71 switch (eTelescopeName) {
73 strcpy(szTelescopeFlag,
"CO1");
76 strcpy(szTelescopeFlag,
"CO2");
79 strcpy(szTelescopeFlag,
"CO3");
82 strcpy(szTelescopeFlag,
"CO4");
85 strcpy(szTelescopeFlag,
"CO5");
88 strcpy(szTelescopeFlag,
"CO6");
91 strcpy(szTelescopeFlag,
"LA1");
94 strcpy(szTelescopeFlag,
"LA2");
97 strcpy(szTelescopeFlag,
"LA3");
100 strcpy(szTelescopeFlag,
"LA4");
103 strcpy(szTelescopeFlag,
"LA5");
106 strcpy(szTelescopeFlag,
"LA6");
109 strcpy(szTelescopeFlag,
"LL1");
112 strcpy(szTelescopeFlag,
"LL2");
115 strcpy(szTelescopeFlag,
"LL3");
118 strcpy(szTelescopeFlag,
"LL4");
121 strcpy(szTelescopeFlag,
"LL5");
124 strcpy(szTelescopeFlag,
"LL6");
127 strcpy(szTelescopeFlag,
"LM1");
130 strcpy(szTelescopeFlag,
"LM2");
133 strcpy(szTelescopeFlag,
"LM3");
136 strcpy(szTelescopeFlag,
"LM4");
139 strcpy(szTelescopeFlag,
"LM5");
142 strcpy(szTelescopeFlag,
"LM6");
145 strcpy(szTelescopeFlag,
"NaN");
149 while (!feof(pfile)) {
150 memset(szaux, 0,
sizeof(szaux));
151 memset(szbuff, 0,
sizeof(szbuff));
152 memset(¶ms, 0,
sizeof(params));
154 char* d = fgets(szbuff, 512, pfile);
155 if (!d && !feof(pfile))
157 if (szbuff[0] ==
'#')
161 memcpy(szaux, szbuff, 3);
162 if (strcmp(szaux, szTelescopeFlag))
169 if((ppos2=strchr(szbuff,
'\t'))==NULL) G4cerr<<
"parse file error at line "<<szbuff<<
": cannot find delimiter"<<G4endl;
171 strcpy(szaux,szbuff+4);
172 if((params.
nPosition=atoi(szaux))==0) G4cerr<<
"parse file error at line "<<szbuff<<
": wrong position format"<<G4endl;
176 if((ppos2=strchr(ppos1,
'\t'))==NULL) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": cannot find delimiter"<<G4endl;
179 if((params.
nMirrorID=atoi(szaux))==0) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": wrong mirror id format"<<G4endl;
183 if((ppos2=strchr(ppos1,
'\t'))==NULL) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": cannot find delimiter"<<G4endl;
186 if(strcmp(szaux,
"IV")==0) params.
nType=4;
187 else if(strcmp(szaux,
"III")==0) params.
nType=3;
188 else if(strcmp(szaux,
"II")==0) params.
nType=2;
189 else if(strcmp(szaux,
"I")==0) params.
nType=1;
190 else if(strcmp(szaux,
"XIII")==0)params.
nType=13;
191 else if(strcmp(szaux,
"XII")==0) params.
nType=12;
192 else if(strcmp(szaux,
"XI")==0) params.
nType=11;
193 else G4cerr<<
"parse file error at position "<<params.
nPosition<<
": wrong mirror shape format"<<G4endl;
197 if((ppos2=strchr(ppos1,
'\t'))==NULL) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": cannot find delimiter"<<G4endl;
200 if((params.
fRadius=atof(szaux))==0) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": wrong radius-of-curvature format"<<G4endl;
204 if((ppos2=strchr(ppos1,
'\t'))==NULL) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": cannot find delimiter"<<G4endl;
207 if((params.
fReflec375=atof(szaux))==0) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": wrong radius-of-curvature format"<<G4endl;
211 if((ppos2=strchr(ppos1,
'\t'))==NULL) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": cannot find delimiter"<<G4endl;
218 if((ppos2=strchr(ppos1,
'\t'))==NULL) G4cerr<<
"parse file error at position "<<params.
nPosition<<
": cannot find delimiter"<<G4endl;
236 const char szServerIP[],
const char szDbName[])
Base class to report exceptions in IO.
CMirrorParamsReaderFromDb(const char szUser[], const char szPassword[], const char szServerIP[], const char szDbName[])
eTelescope eTelescopeName
virtual G4int ReadMirrorParams(eTelescope eTelescopeName)
G4bool GetMirrorParams(PMIRRORPARAMS pparams, G4int &nParamsCnt)
CMirrorParamsReaderBase()
map< int, MIRRORPARAMS > m_MirrorParams
virtual G4int ReadMirrorParams(eTelescope eTelescopeName)
CMirrorParamsReaderFromFile(const char szFilename[])