diff --git a/include/DetectorConstruction.hh b/include/DetectorConstruction.hh index 72d3fb564a278c1cdac2934f06bc38f5911d0e7b..e1bf5c632a3c3ab591b8cba8ce4dfb8def3163a3 100644 --- a/include/DetectorConstruction.hh +++ b/include/DetectorConstruction.hh @@ -38,7 +38,7 @@ #include "G4LogicalVolume.hh" #include "G4VUserDetectorConstruction.hh" #include "G4SubtractionSolid.hh" -#include "G4GDMLParser.hh" +//#include "G4GDMLParser.hh" #include "G4RunManager.hh" #include "Materials.hh" @@ -115,7 +115,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction G4Material* m_filler; G4MaterialPropertiesTable* m_GasMPT; - G4GDMLParser m_Parser; + //G4GDMLParser m_Parser; G4RunManager* m_runMan; DetectorMessenger* m_DetectorMessenger; }; diff --git a/src/DetectorConstruction.cc b/src/DetectorConstruction.cc index 595d0e453800a70bc938995e0fb7ea0aba007992..05d5f61a54f50511943607f879f845517291e672 100644 --- a/src/DetectorConstruction.cc +++ b/src/DetectorConstruction.cc @@ -59,7 +59,7 @@ #include "G4VisExtent.hh" #include "G4Colour.hh" #include "G4UImanager.hh" -#include "G4GDMLParser.hh" +//#include "G4GDMLParser.hh" /* * @@ -79,6 +79,7 @@ DetectorConstruction::DetectorConstruction() m_ConstructionHasBeenDone(false), m_UsingCADmodel(false), m_logicWorld(0), + m_logicLightGuide(0), m_DetectorMessenger(nullptr) { materials = Materials::getInstance(); @@ -286,6 +287,45 @@ void DetectorConstruction::PlaceGeometry(){ G4RotationMatrix * PMTrot = new G4RotationMatrix(); PMTrot->rotateX(90*deg); +if(m_nSegmentsX == 1 && m_nSegmentsZ == 1){ + + m_physLightGuide.push_back( + new G4PVPlacement(m_rotation, + G4ThreeVector(m_LGpos->x(), m_LGpos->y(), m_LGpos->z()), + m_logicLightGuide, + "LightGuide", + m_logicHalfWorld, + false, + 0) ); + + //----------------- Place the PMT -----------------// + + m_physPMT.push_back( + new G4PVPlacement(PMTrot, + G4ThreeVector(m_pmtPos->x(), m_pmtPos->y(), m_pmtPos->z()), + m_logicPMT, + "PMT", + m_logicHalfWorld, + false, + 0) ); + + //----------------- Define Optical Borders -----------------// + + m_Surfvec.push_back( + new G4LogicalBorderSurface("AlSurface", + m_physLightGuide.back(), + m_physHalfWorld, + materials->AlSurface ) ); + m_Surfvec.push_back( + new G4LogicalBorderSurface("AlSurface", + m_physHalfWorld, + m_physLightGuide.back(), + materials->AlSurface ) ); + + + return; + } + char name[40]; @@ -503,12 +543,12 @@ void DetectorConstruction::UseCADModel(G4String fileName){ "LightGuide"); //name } - if(fileType == "gdml"){ - m_Parser.Read(fileName); - } - if(fileType == "step"){ - m_logicLightGuide = m_Parser.ParseST(fileName,materials->Air,materials->Al); - } + // if(fileType == "gdml"){ + // m_Parser.Read(fileName); + // } + // if(fileType == "step"){ + // m_logicLightGuide = m_Parser.ParseST(fileName,materials->Air,materials->Al); + // } if(m_logicLightGuide !=0 ){ @@ -544,15 +584,17 @@ void DetectorConstruction::UseCADModel(G4String fileName){ * Output the model of the light guide to GDML */ void DetectorConstruction::OutputToGDML(G4String fileName){ - if(m_physLightGuide[0] != 0){ + + G4cout << "Go home, you're drunk" << G4endl; + // if(m_physLightGuide[0] != 0){ //For some reason this only works as a pointer - G4GDMLParser* gdml = new G4GDMLParser(); - gdml->Write(fileName.c_str(),m_physLightGuide.back()); - delete gdml; - }else{ - G4cout << "No physical light guide defined..." << G4endl; - G4cout << "Can't write model to GDML" << G4endl; - } + // G4GDMLParser* gdml = new G4GDMLParser(); + // gdml->Write(fileName.c_str(),m_physLightGuide.back()); + // delete gdml; + // }else{ + // G4cout << "No physical light guide defined..." << G4endl; + // G4cout << "Can't write model to GDML" << G4endl; + // } } /*