FairCave.cxx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /********************************************************************************
  2. * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
  3. * *
  4. * This software is distributed under the terms of the *
  5. * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
  6. * copied verbatim in the file "LICENSE" *
  7. ********************************************************************************/
  8. /* Generated by Together */
  9. #include "FairCave.h"
  10. #include "FairGeoCave.h" // for FairGeoCave
  11. #include "FairGeoInterface.h" // for FairGeoInterface
  12. #include "FairGeoLoader.h" // for FairGeoLoader
  13. #include "FairGeoNode.h" // for FairGeoNode
  14. #include "FairGeoPassivePar.h" // for FairGeoPassivePar
  15. #include "FairGeoVolume.h" // for FairGeoVolume
  16. #include "FairRun.h" // for FairRun
  17. #include "FairRuntimeDb.h" // for FairRuntimeDb
  18. #include "TList.h" // for TListIter, TList (ptr only)
  19. #include "TObjArray.h" // for TObjArray
  20. #include "TString.h" // for TString
  21. #include <stddef.h> // for NULL
  22. ClassImp(FairCave)
  23. void FairCave::ConstructGeometry()
  24. {
  25. FairGeoLoader* loader=FairGeoLoader::Instance();
  26. FairGeoInterface* GeoInterface =loader->getGeoInterface();
  27. FairGeoCave* MGeo=new FairGeoCave();
  28. MGeo->setGeomFile(GetGeometryFileName());
  29. GeoInterface->addGeoModule(MGeo);
  30. Bool_t rc = GeoInterface->readSet(MGeo);
  31. if ( rc ) { MGeo->create(loader->getGeoBuilder()); }
  32. TList* volList = MGeo->getListOfVolumes();
  33. // store geo parameter
  34. FairRun* fRun = FairRun::Instance();
  35. FairRuntimeDb* rtdb= FairRun::Instance()->GetRuntimeDb();
  36. FairGeoPassivePar* par=static_cast<FairGeoPassivePar*>(rtdb->getContainer("FairGeoPassivePar"));
  37. TObjArray* fSensNodes = par->GetGeoSensitiveNodes();
  38. TObjArray* fPassNodes = par->GetGeoPassiveNodes();
  39. TListIter iter(volList);
  40. FairGeoNode* node = NULL;
  41. FairGeoVolume* aVol=NULL;
  42. while( (node = static_cast<FairGeoNode*>(iter.Next())) ) {
  43. aVol = dynamic_cast<FairGeoVolume*> ( node );
  44. if ( node->isSensitive() ) {
  45. fSensNodes->AddLast( aVol );
  46. } else {
  47. fPassNodes->AddLast( aVol );
  48. }
  49. }
  50. par->setChanged();
  51. par->setInputVersion(fRun->GetRunId(),1);
  52. }
  53. FairCave::FairCave()
  54. {
  55. }
  56. FairCave::~FairCave()
  57. {
  58. }
  59. FairCave::FairCave(const char* name, const char* Title)
  60. : FairModule(name ,Title)
  61. {
  62. world[0] = 0;
  63. world[1] = 0;
  64. world[2] = 0;
  65. }