If data from Parameter file differs from ours TODO: should understand a way of storring parameters in SHIP Text file constructor
FairRunAna* ana = FairRunAna::Instance(); if (ana!=NULL) { FairRuntimeDb* rtdb=ana->GetRuntimeDb(); rtdb->getContainer("CbmGeoHcalPar"); }
140 : TObject(),
164{
176 std::ifstream file(filename);
177 Int_t linenum;
179 string buffer;
180 string message;
181 string variable;
182 string value;
183 TObjString*
str=NULL;
184 char** err=NULL;
185 char winend[2]={13, 0};
186 int ssize=-1;
187
188 if (!file) {
189 cerr <<
"hcalInf: Can't open information file " <<
filename <<
"!" << endl;
190 cerr << "hcalInf: Hcal will not be constructed correctly." << endl;
192 return;
193 }
194
195 linenum=0;
196 while(getline(file,buffer)) {
197 linenum++;
198 message=buffer.substr(buffer.find_first_not_of(" "));
199 message=message.substr(0,message.find("#"));
200
201 message=message.substr(0,message.find(winend));
202 if (message.empty()) continue;
203 variable=message.substr(0,message.find("="));
204 if (variable=="structure") {
205 while(getline(file,buffer)) {
206 linenum++;
207 if (buffer.empty()) break;
208 message=buffer.substr(buffer.find_first_not_of(" "));
209 message=message.substr(0,message.find("#"));
210 message=message.substr(0,message.find_last_not_of(" ")+1);
211
212
213 message=message.substr(0,message.find(winend));
214
215 if (!message.empty()) {
216 if (-1==ssize)
217 ssize=message.size();
218 else
219 if (ssize!=(Int_t)message.size()) {
220 cerr << "Error in HCAL structure at line " << linenum;
221 cerr << "." << endl;
222 cerr << "Line length differs from previous one" << endl;
224 file.close();
225 return;
226
227 }
228
229 str=
new TObjString(message.c_str());
231 }
232 }
233 break;
234 }
235 if (variable==message) {
236 cerr <<
"Syntax error: File " <<
filename <<
".Line " << linenum <<
"." << endl;
238 file.close();
239 return;
240 }
241 variable=variable.substr(0,variable.find_first_of(" "));
242 value=message.substr(message.find("=")+1);
243 value=value.substr(value.find_first_not_of(" "));
244 value=value.substr(0,value.find_first_of(" "));
245
246
247
248
249
250
251
252
253
254
256 }
257 file.close();
259}
void AddVariable(const char *key, const char *value)