-
Administrator authored
This version is an exact copy of the last revision of the trunk branch of the old SVN repository of CbmRoor at https://subversion.gsi.de/cbmsoft/cbmroot/trunk The old SVN repository will still be available for read access.
Administrator authoredThis version is an exact copy of the last revision of the trunk branch of the old SVN repository of CbmRoor at https://subversion.gsi.de/cbmsoft/cbmroot/trunk The old SVN repository will still be available for read access.
CbmPlatform.cxx 2.70 KiB
/* 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 "CbmGeometryUtils.h"
#include "TList.h"
#include "TObjArray.h"
#include "TGeoManager.h"
#include "TFile.h"
#include "TKey.h"
CbmPlatform::CbmPlatform()
: FairModule(),
fCombiTrans(),
fVolumeName("")
{
}
CbmPlatform::CbmPlatform(const char * name, const char * title)
: FairModule(name ,title),
fCombiTrans(),
fVolumeName("")
{
}
CbmPlatform::~CbmPlatform()
{
}
void CbmPlatform::ConstructGeometry()
{
TString fileName = GetGeometryFileName();
if ( fileName.EndsWith(".root") ) {
if ( Cbm::GeometryUtils::IsNewGeometryFile(fgeoName) ) {
LOG(info) << "Importing Platform geometry from ROOT file "
<< fgeoName.Data();
Cbm::GeometryUtils::ImportRootGeometry(fgeoName, this, fCombiTrans);
} else {
LOG(info) << "Constructing Platform geometry from ROOT file "
<< fgeoName.Data();
FairModule::ConstructRootGeometry();
}
}
else if ( fileName.EndsWith(".geo") ) {
LOG(info) << "Constructing PLATFORM from ASCII file "
<< fileName.Data();
ConstructAsciiGeometry();
}
else
LOG(fatal) << "Geometry format of PLATFORM file " << fileName.Data()
<< " not supported.";
}
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<FairGeoVolume*> ( node );
if ( node->isSensitive() ) {
fSensNodes->AddLast( aVol );
}else{
fPassNodes->AddLast( aVol );
}
}
ProcessNodes( volList );
par->setChanged();
par->setInputVersion(fRun->GetRunId(),1);
}
ClassImp(CbmPlatform)