1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /* Generated by Together */
- #include "FairPipe.h"
- #include "FairGeoLoader.h"
- #include "FairGeoInterface.h"
- #include "FairGeoPipe.h"
- #include "FairGeoRootBuilder.h"
- #include "FairGeoNode.h"
- #include "FairRuntimeDb.h"
- #include "FairGeoPassivePar.h"
- #include "TObjArray.h"
- #include "FairRun.h"
- #include "FairGeoVolume.h" // for FairGeoVolume
- #include <stddef.h> // for NULL
- #include <iostream> // for operator<<, basic_ostream, etc
- FairPipe::~FairPipe()
- {
- }
- FairPipe::FairPipe()
- {
- }
- FairPipe::FairPipe(const char * name, const char * title)
- : FairModule(name ,title)
- {
- }
- void FairPipe::ConstructGeometry()
- {
- TString fileName=GetGeometryFileName();
- if (fileName.EndsWith(".geo")) {
- ConstructASCIIGeometry();
- } else if(fileName.EndsWith(".root")) {
- ConstructRootGeometry();
- } else {
- std::cout<< "Geometry format not supported " <<std::endl;
- }
- }
- void FairPipe::ConstructASCIIGeometry(){
- FairGeoLoader *loader=FairGeoLoader::Instance();
- FairGeoInterface *GeoInterface =loader->getGeoInterface();
- FairGeoPipe *MGeo=new FairGeoPipe();
- 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();
- FairGeoPassivePar* par=(FairGeoPassivePar*)(rtdb->getContainer("FairGeoPassivePar"));
- 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(FairPipe)
|