#include "GDMLDetectorConstruction.hh" #include "ACDSD.hh" //Sensitive Detector Class #include "G4SDManager.hh" #include "G4GDMLParser.hh" #include "G4Material.hh" #include "G4NistManager.hh" #include "G4GeometryManager.hh" #include "G4UserLimits.hh" #include "G4SystemOfUnits.hh" #include "G4PhysicalConstants.hh" #include "G4LogicalVolume.hh" #include "G4Sphere.hh" #include "G4Box.hh" #include "G4Tubs.hh" #include "G4Cons.hh" #include "G4Polyhedra.hh" #include "G4Trap.hh" #include "G4Trd.hh" #include "G4Hype.hh" #include "G4ThreeVector.hh" #include "G4Transform3D.hh" #include "G4SubtractionSolid.hh" #include "G4RotationMatrix.hh" #include "G4PVReplica.hh" #include "G4ExtrudedSolid.hh" #include "G4PVPlacement.hh" #include "G4PVParameterised.hh" #include "G4GeometryTolerance.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4ios.hh" #include "globals.hh" #include #include #include #include #include // format manipulation #include #include #include #include GDMLDetectorConstruction::GDMLDetectorConstruction(const G4GDMLParser& parser) : G4VUserDetectorConstruction(), fParser(parser) {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* GDMLDetectorConstruction::Construct() { return fParser.GetWorldVolume(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void GDMLDetectorConstruction::ConstructSDandField() { //------------------------------------------------ // Sensitive detectors //------------------------------------------------ G4SDManager* SDman = G4SDManager::GetSDMpointer(); G4String trackerChamberSDname = "Tracker"; G4VSensitiveDetector* aTrackerSD = new ACDSD(trackerChamberSDname); SDman->AddNewDetector( aTrackerSD ); /////////////////////////////////////////////////////////////////////// // // Example how to retrieve Auxiliary Information for sensitive detector // const G4GDMLAuxMapType* auxmap = fParser.GetAuxMap(); G4cout << "Found " << auxmap->size() << " volume(s) with auxiliary information." << G4endl << G4endl; for(G4GDMLAuxMapType::const_iterator iter=auxmap->begin(); iter!=auxmap->end(); iter++) { G4cout << "Volume " << ((*iter).first)->GetName() << " has the following list of auxiliary information: " << G4endl << G4endl; for (G4GDMLAuxListType::const_iterator vit=(*iter).second.begin(); vit!=(*iter).second.end(); vit++) { G4cout << "--> Type: " << (*vit).type << " Value: " << (*vit).value << G4endl; } } G4cout << G4endl; // The same as above, but now we are looking for // sensitive detectors setting them for the volumes for(G4GDMLAuxMapType::const_iterator iter=auxmap->begin(); iter!=auxmap->end(); iter++) { G4cout << "Volume " << ((*iter).first)->GetName() << " has the following list of auxiliary information: " << G4endl << G4endl; for (G4GDMLAuxListType::const_iterator vit=(*iter).second.begin(); vit!=(*iter).second.end();vit++) { if ((*vit).type=="SensDet") { G4cout << "********* Attaching sensitive detector " << (*vit).value << " to volume " << ((*iter).first)->GetName() << G4endl << G4endl; G4VSensitiveDetector* mydet = SDman->FindSensitiveDetector((*vit).value); if(mydet) { G4LogicalVolume* myvol = (*iter).first; myvol->SetSensitiveDetector(mydet); } else { G4cout << (*vit).value << " detector not found" << G4endl; } } } } //------------------------------------------------------------------------------------------------------ //--------------------- regions assignment: closer to the detector, lower the Ecut -------------- //------------------------------------------------------------------------------------------------------ G4Region* InnerRegion =new G4Region("InnerRegion"); //everything directly seen by the detector // InnerRegion->AddRootLogicalVolume(_log); G4Region* IntermediateRegion =new G4Region("IntermediateRegion"); //the FPA not directly seen by the detector //IntermediateRegion->AddRootLogicalVolume(_log); G4Region* ExternalRegion =new G4Region("ExternalRegion"); //the external region //ExternalRegion->AddRootLogicalVolume(_log); }