void KVFAZIA::Build(Int_t) { // Build the combined INDRA & FAZIA arrays GetGeometryParameters(); GenerateCorrespondanceFile(); if (!gGeoManager) { new TGeoManager("FAZIA", Form("FAZIA geometry for dataset %s", gDataSet->GetName())); TGeoMaterial* matVacuum = gGeoManager->GetMaterial("Vacuum"); if (!matVacuum) { matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0); matVacuum->SetTitle("Vacuum"); } TGeoMedium* Vacuum = gGeoManager->GetMedium("Vacuum"); if (!Vacuum) Vacuum = new TGeoMedium("Vacuum", 1, matVacuum); TGeoVolume* top = gGeoManager->MakeBox("WORLD", Vacuum, 500, 500, 500); gGeoManager->SetTopVolume(top); } BuildFAZIA(); if (fBuildTarget) BuildTarget(); KVGeoImport imp(gGeoManager, KVMaterial::GetRangeTable(), this, kTRUE); imp.SetDetectorPlugin(ClassName()); imp.SetNameCorrespondanceList(fCorrespondanceFile.Data()); // any additional structure name formatting definitions DefineStructureFormats(imp); // the following parameters are optimized for a 12-block compact // geometry placed at 80cm with rings 1-5 of INDRA removed. // make sure that the expected number of detectors get imported! imp.ImportGeometry(fImport_dTheta, fImport_dPhi, fImport_ThetaMin, fImport_PhiMin, fImport_ThetaMax, fImport_PhiMax); /* KVFAZIADetector* det=0; TIter next_d(GetDetectors()); while ( det = (KVFAZIADetector* )next_d() ){ printf("%s %s %d %d %d\n",det->GetName(),det->GetFAZIAType(),det->GetBlockNumber(),det->GetQuartetNumber(),det->GetTelescopeNumber()); } */ SetIdentifications(); SortIDTelescopes(); KVDetector* det = GetDetector("SI2-T1-Q1-B001"); det->GetIDTelescopes()->ls(); SetDetectorThicknesses(); SetBit(kIsBuilt); }
void mhmakefileparser::GetAutoDeps(const fileinfo *pFirstDep, deps_t &Autodeps) { /* Here we have to scan only c/c++ headers so skip certain extensions */ const char *pFullName=pFirstDep->GetFullFileName().c_str(); const char *pExt=strrchr(pFullName,'.'); bool bPython=false; if (pExt) { if (!_stricmp(pExt+1,"py")) bPython=true; } FILE *pIn=fopen(pFullName,"r"); if (!pIn) return; char IncludeList[255]; int PrevRet=0; int Ret=fgetc(pIn); while(Ret!=EOF) { char Type[2]; bool bFound=false; if (bPython) { Type[0]='"'; if (Ret=='i') { Ret=fscanf(pIn,"mport%*[ \t]%254[^\"\n]",IncludeList); if (Ret==1) { if (IncludeList[0]!='*') bFound=true; } } } else { if (PrevRet=='/') { if (Ret=='/') { /* This is a C++ command so read until the next line-feed */ do { Ret=fgetc(pIn); } while (Ret!='\n' && Ret!=EOF); } else if (Ret=='*') { /* This is a standard C comment, so read until then end of the command */ do { PrevRet=Ret; Ret=fgetc(pIn); } while ((PrevRet!='*' || Ret!='/') && Ret!=EOF); } } else if (Ret=='#' || Ret=='.') { if (Ret=='#') { Ret=fscanf(pIn,"%*[ \t]"); Ret=fscanf(pIn,"include%*[ \t]%1[\"<]%254[^>\"]%*[\">]",(char*)&Type,IncludeList); } else Ret=fscanf(pIn,"import%*[ \t]%1[\"<]%254[^>\"]%*[\">]",(char*)&Type,IncludeList); if (Ret==2) { bFound=true; } } } if (bFound) { const char *pTmp=IncludeList; while (*pTmp) { string IncludeFile; pTmp=NextItem(pTmp,IncludeFile," \t,"); if (bPython) IncludeFile+=".py"; if (SkipHeaderFile(IncludeFile)) continue; #ifdef _DEBUG m_ImplicitSearch++; // This is to avoid warnings of targets that does not exist #endif if (Type[0]=='"') { fileinfo *pInclude=GetFileInfo(IncludeFile,pFirstDep->GetDir()); /* Add the dependency when the file alrady exist or there is a rule available to be build */ mh_time_t Date=BuildTarget(pInclude); if (Date.DoesExist()) // Try to build the target, and add it if it exists after building { deps_t::const_iterator pFind=Autodeps.find(pInclude); if (pFind==Autodeps.end()) { Autodeps.insert(pInclude); GetAutoDepsIfNeeded(pInclude,pInclude); } } } const refptr<fileinfoarray> IncludeDirs=GetIncludeDirs(); fileinfoarray::const_iterator It=IncludeDirs->begin(); while (It<IncludeDirs->end()) { fileinfo *pInclude=GetFileInfo(IncludeFile,*It); mh_time_t Date=BuildTarget(pInclude); if (Date.DoesExist()) // Try to build the target, and add it if it exists after building { deps_t::const_iterator pFind=Autodeps.find(pInclude); if (pFind==Autodeps.end()) { Autodeps.insert(pInclude); GetAutoDepsIfNeeded(pInclude,pInclude); } break; } It++; } #ifdef _DEBUG m_ImplicitSearch--; #endif } } PrevRet=Ret; Ret=fgetc(pIn); } fclose(pIn); }