65 file =
new std::fstream();
69 if (!filedir.IsNull()) {
70 filename = filedir +
"/" + fname;
74 filename = filename.Strip();
75 if (strcmp(status,
"in") == 0) {
76 file->open(filename, ios::in);
79 if (strcmp(status,
"out") == 0) {
80 file->open(filename, ios::in);
84 file->open(filename, ios::out);
88 Error(
"open",
"Output file %s exists already and will not be recreated.", filename.Data());
92 Error(
"open",
"Invalid file option!");
95 if (file->rdbuf()->is_open() == 0) {
96 Error(
"open",
"Failed to open file %s", filename.Data());
105 if (file && file->rdbuf()->is_open() == 1) {
114 if (
isOpen() && writable) {
134 cout <<
"Open output file: " << filename << endl;
136 cout <<
"Open input file: " << filename << endl;
139 cout <<
"No file open." << endl;
146 if (!
isOpen() || writable || set == 0) {
149 std::fstream& fin = *file;
151 fin.seekg(0, ios::beg);
153 Int_t sensitivity = 0, na = 0;
158 TString volumeName =
"";
164 volu->SetName(volumeName);
168 if (sensitivity > 0) {
172 TString motherName =
"";
175 if (motherName ==
"world") {
178 mother = set->
getVolume(motherName.Data());
183 fin >> t[0] >> t[1] >> t[2];
184 for (Int_t kk = 0; kk < 3; kk++) {
187 for (Int_t i = 0; i < 9; i++) {
194 TString materialName =
"";
209 cerr <<
"Shape " << type <<
" not supported." << endl;
213 Double_t*
par =
new Double_t[npar]();
214 for (Int_t ik = 0; ik < npar; ik++) {
217 Bool_t rc = calculateShapePoints(par, volu);
220 cerr <<
"Conversion for shape " << type <<
" not implemented." << endl;
224 TString control =
"";
226 if (control !=
"#fi" && !fin.eof()) {
227 cerr <<
"End of File section is '" << control <<
"' instead of '#fi'." << endl;
236 Bool_t FairGeoOldAsciiIo::calculateShapePoints(Double_t*
par,
FairGeoNode* volu)
239 TString shName = sh->GetName();
243 if (shName ==
"BOX ") {
244 Double_t x = par[0] * 10.;
245 Double_t y = par[1] * 10.;
246 Double_t z = par[2] * 10.;
255 }
else if (shName ==
"TUBE") {
256 Double_t z = par[2] * 10.;
258 volu->
setPoint(1, par[0] * 10., par[1] * 10., 0.);
260 }
else if (shName ==
"TUBS") {
261 Double_t z = par[2] * 10.;
262 Double_t a = par[3] / 6.28318548 * 360;
264 volu->
setPoint(1, par[0] * 10., par[1] * 10., 0.);
266 volu->
setPoint(3, a, par[4] / 6.28318548 * 360 + a, 0.);
267 }
else if (shName ==
"CONE") {
268 Double_t z = par[4] * 10.;
270 volu->
setPoint(1, par[0] * 10., par[1] * 10., 0.);
272 volu->
setPoint(3, par[2] * 10., par[3] * 10., 0.);
273 }
else if (shName ==
"CONS") {
274 Double_t z = par[4] * 10.;
275 Double_t a = par[5] / 6.28318548 * 360;
277 volu->
setPoint(1, par[0] * 10., par[1] * 10., 0.);
279 volu->
setPoint(3, par[2] * 10., par[3] * 10., 0.);
280 volu->
setPoint(4, a, par[6] / 6.28318548 * 360 + a, 0.);
281 }
else if (shName ==
"SPHE") {
282 Double_t a = par[4] / 6.28318548 * 360;
283 volu->
setPoint(0, par[0] * 10., par[1] * 10., 0.);
284 volu->
setPoint(1, par[1], par[2], 0.);
285 volu->
setPoint(2, a, par[5] / 6.28318548 * 360 + a, 0.);
286 }
else if (shName ==
"ELTU") {
287 Double_t z = par[2] * 10.;
289 volu->
setPoint(1, par[0] * 10., par[1] * 10., 0.);
void setPoint(const Int_t, const Double_t, const Double_t, const Double_t)
FairGeoShapes * getShapes()
Bool_t read(FairGeoMedia *)
ClassImp(FairEventBuilder)
void setMother(FairGeoNode *s)
void setShape(FairGeoBasicShape *s)
FairGeoNode * getVolume(const char *name)
Bool_t open(const char *, const Text_t *status="in")
void createPoints(const Int_t)
FairGeoBasicShape * selectShape(FairGeoVolume *)
TList * getListOfVolumes()
FairMQExParamsParOne * par
void setMedium(FairGeoMedium *med)
FairGeoTransform & getTransform()
FairGeoNode * getMasterNode(const char *name)
FairGeoBasicShape * getShapePointer()