35 #include <TObjArray.h>
39 #include <sys/select.h>
54 , sets(new TObjArray())
57 , masterNodes(new TList())
79 masterNodes->Delete();
110 Error(
"This Methode is not used any more ",
"Use addGeoModule to add detectors: %s", file);
184 TString setName(name);
187 Int_t l = setName.Last(
'/') + 1;
188 setName = setName(l, setName.Length() - l);
200 for (Int_t i = 0; i < nSets; i++) {
201 PSetName = sets->At(i)->GetName();
202 if (PSetName.Contains(setName.Data())) {
204 cout <<
"FairGeoInterface::findSet" << pSet->GetName() << endl;
219 rc = input->
read(pSet, media);
228 if (pSet && connectOutput(pSet->GetName())) {
229 return output->
write(pSet);
237 if (pSet && output) {
238 output->
open(filename,
"out");
240 return output->
write(pSet);
262 rc = input->
read(media);
270 if (connectOutput(
"media")) {
271 return output->
write(media);
280 output->
open(filename,
"out");
282 return output->
write(media);
292 if (nActualSets == 0 && oraInput) {
306 for (Int_t i = 0; i < nSets && rc; i++) {
309 cout <<
"Read " << pSet->GetName() << endl;
322 for (Int_t i = 0; i < nSets && rc; i++) {
339 for (Int_t i = 0; i < nSets && rc; i++) {
342 cout <<
"Create " << pSet->GetName() << endl;
343 rc = pSet->
create(geoBuilder);
355 Error(
"createAll()",
"No Builder");
367 if (nActualSets == 0 && oraInput) {
380 for (Int_t i = 0; i < nSets && rc; i++) {
383 cout <<
"Read and create " << pSet->GetName() << endl;
386 rc = pSet->
create(geoBuilder);
399 Error(
"createAll()",
"No Builder");
404 FairGeoIo* FairGeoInterface::connectInput(
const char* filename)
411 if (s.EndsWith(
".dat") || s.EndsWith(
".geo") || s.EndsWith(
".setup")) {
415 fileInput->
open(filename);
416 currentIo = fileInput;
417 }
else if (s.EndsWith(
"_gdb")) {
418 currentIo = oraInput;
421 if (currentIo && currentIo->
isOpen()) {
427 Bool_t FairGeoInterface::connectOutput(
const char* name)
431 if (strcmp(output->IsA()->GetName(),
"FairGeoAsciiIo") == 0) {
437 newtime = localtime(&t);
438 if (newtime->tm_mday < 10) {
439 sprintf(buf,
"_0%i", newtime->tm_mday);
441 sprintf(buf,
"_%i", newtime->tm_mday);
444 if (newtime->tm_mon < 9) {
445 sprintf(buf,
"0%i", newtime->tm_mon + 1);
447 sprintf(buf,
"%i", newtime->tm_mon + 1);
450 Int_t y = newtime->tm_year - 100;
452 sprintf(buf,
"0%i", y);
454 sprintf(buf,
"%i", y);
457 if (newtime->tm_hour < 10) {
458 sprintf(buf,
"0%i", newtime->tm_hour);
460 sprintf(buf,
"%i", newtime->tm_hour);
463 if (newtime->tm_min < 10) {
464 sprintf(buf,
"0%i", newtime->tm_min);
466 sprintf(buf,
"%i", newtime->tm_min);
469 if (newtime->tm_sec < 10) {
470 sprintf(buf,
"0%i", newtime->tm_sec);
472 sprintf(buf,
"%i", newtime->tm_sec);
474 fName = fName + buf +
".geo";
475 output->
open(fName,
"out");
476 cout <<
"Output file for " << name <<
": " << (
static_cast<FairGeoAsciiIo*
>(output))->getFilename()
483 Error(
"connectOutput",
"No output open");
494 return pSet->
create(geoBuilder);
501 cout <<
"********************************************************************\n";
502 cout <<
"List of detector parts:\n";
504 for (Int_t i = 0; i < nSets; i++) {
507 cout <<
" " << pSet->GetName() <<
":\t" << pSet->
getGeomFile() <<
'\n';
510 cout <<
"********************************************************************\n";
519 input = connectInput(configFile);
531 if (setupFile.Length() > 0) {
void setMediaFile(const char *file)
void deleteSet(FairGeoSet *pSet)
virtual Bool_t write(FairGeoMedia *)=0
Bool_t readSet(FairGeoSet *)
Bool_t readGeomConfig(const char *)
Bool_t readDetectorSetup(FairGeoInterface *)
Bool_t createSet(FairGeoSet *)
Bool_t createGeometry(Bool_t withCleanup=kFALSE)
virtual Bool_t readGeomConfig(FairGeoInterface *)=0
void setMasterNodes(TList *m)
void addGeoModule(FairGeoSet *)
virtual Bool_t create(FairGeoBuilder *)
virtual Bool_t isOpen()=0
ClassImp(FairEventBuilder)
virtual Bool_t read(FairGeoMedia *)=0
Bool_t writeSet(FairGeoSet *)
void setShapes(FairGeoShapes *s)
Bool_t createAll(Bool_t withCleanup=kFALSE)
FairGeoSet * findSet(const char *)
void addInputFile(const char *)
virtual Bool_t isWritable()=0
virtual Bool_t open(const char *, const Text_t *status="in")=0
const char * getGeomFile()