/* Generated by Together */ #include "CbmPlatform.h" #include "CbmGeoPlatform.h" #include "CbmGeoPassivePar.h" #include "FairGeoLoader.h" #include "FairGeoInterface.h" #include "FairGeoNode.h" #include "FairRuntimeDb.h" #include "FairRun.h" #include "TList.h" #include "TObjArray.h" CbmPlatform::CbmPlatform() : FairModule() { } CbmPlatform::CbmPlatform(const char * name, const char * title) : FairModule(name ,title) { } CbmPlatform::~CbmPlatform() { } void CbmPlatform::ConstructGeometry() { TString fileName = GetGeometryFileName(); if ( fileName.EndsWith(".root") ) { LOG(INFO) << "Constructing PLATFORM from ROOT file " << fileName.Data() << FairLogger::endl; ConstructRootGeometry(); } else if ( fileName.EndsWith(".geo") ) { LOG(INFO) << "Constructing PLATFORM from ASCII file " << fileName.Data() << FairLogger::endl; ConstructAsciiGeometry(); } else LOG(FATAL) << "Geometry format of PLATFORM file " << fileName.Data() << " not supported." << FairLogger::endl; } void CbmPlatform::ConstructAsciiGeometry() { FairGeoLoader *loader=FairGeoLoader::Instance(); FairGeoInterface *GeoInterface =loader->getGeoInterface(); CbmGeoPlatform *MGeo=new CbmGeoPlatform(); MGeo->setGeomFile(GetGeometryFileName()); GeoInterface->addGeoModule(MGeo); Bool_t rc = GeoInterface->readSet(MGeo); if ( rc ) MGeo->create(loader->getGeoBuilder()); TList* volList = MGeo->getListOfVolumes(); // store geo parameter FairRun *fRun = FairRun::Instance(); FairRuntimeDb *rtdb= FairRun::Instance()->GetRuntimeDb(); CbmGeoPassivePar* par=(CbmGeoPassivePar*)(rtdb->getContainer("CbmGeoPassivePar")); TObjArray *fSensNodes = par->GetGeoSensitiveNodes(); TObjArray *fPassNodes = par->GetGeoPassiveNodes(); TListIter iter(volList); FairGeoNode *node = NULL; FairGeoVolume *aVol = NULL; while( (node = (FairGeoNode*)iter.Next()) ) { aVol = dynamic_cast ( node ); if ( node->isSensitive() ) { fSensNodes->AddLast( aVol ); }else{ fPassNodes->AddLast( aVol ); } } ProcessNodes( volList ); par->setChanged(); par->setInputVersion(fRun->GetRunId(),1); } ClassImp(CbmPlatform)