Sensitive detector added

parent d137db5f
......@@ -31,10 +31,14 @@
#define B1DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4SDManager.hh"
#include "globals.hh"
#include "G4VisAttributes.hh"
class B1SD;
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4VSensitiveDetector;
/// Detector construction class to define materials and geometry.
......@@ -45,15 +49,16 @@ class B1DetectorConstruction : public G4VUserDetectorConstruction
virtual ~B1DetectorConstruction();
virtual G4VPhysicalVolume* Construct();
G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
G4LogicalVolume* GetScoringDetector() const { return fScoringDetector; }
protected:
G4LogicalVolume* fScoringVolume;
G4LogicalVolume* fScoringDetector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
......@@ -28,6 +28,7 @@
/// \brief Implementation of the B1DetectorConstruction class
#include "B1DetectorConstruction.hh"
#include "B1SD.hh"
#include "G4RunManager.hh"
#include "G4NistManager.hh"
......@@ -40,6 +41,10 @@
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
#include "G4VSensitiveDetector.hh"
#include "G4Track.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -56,34 +61,35 @@ B1DetectorConstruction::~B1DetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B1DetectorConstruction::Construct()
{
{
// Get nist material manager
G4NistManager* nist = G4NistManager::Instance();
G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
// Option to switch on/off checking of volumes overlaps
//
G4bool checkOverlaps = true;
//
//
// World
//
//caracteristicas do cilíndro
//caracteristicas do cilíndro -> world
G4double raio_i = 0;
G4double raio_e = 80.*m;
G4double h = 100.*m;
G4double h_detector = 1.*m;
G4double h = 100.*m;
G4double theta_0 = 0.*deg;
G4double theta_f = 360.*deg;
G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
G4Tubs* cilindro = new G4Tubs("world", raio_i, raio_e, h, theta_0, theta_f);
G4LogicalVolume* logicWorld =
G4LogicalVolume* logicWorld =
new G4LogicalVolume(cilindro, //its solid
world_mat, //its material
"World"); //its name
G4VPhysicalVolume* physWorld =
G4VPhysicalVolume* physWorld =
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicWorld, //its logical volume
......@@ -92,12 +98,45 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
//
//always return the physical World
//
fScoringVolume = logicWorld;
//Criando detetor para ver partículas que chegam à superfície
G4Tubs* detector = new G4Tubs("detector", raio_i, raio_e, h_detector, theta_0, theta_f);
G4LogicalVolume* logicDetector = new G4LogicalVolume(detector,
world_mat,
"detector");
//associando à um sensitive G4VSensitiveDetecto
G4String SDname;
auto sensitive = new B1SD(SDname = "Sensivel");
auto sdman = G4SDManager::GetSDMpointer();
sdman->AddNewDetector(sensitive);
logicDetector->SetSensitiveDetector(sensitive);
G4VPhysicalVolume* physDetector = new G4PVPlacement(0,
G4ThreeVector(0,0,99.*m),
logicDetector,
"detector",
logicWorld,
false,
1,
checkOverlaps);
fScoringDetector = logicDetector;
//colocando cor vermelha para detector
G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
worldVisAtt1->SetVisibility(true);
logicDetector->SetVisAttributes(worldVisAtt1);
return physWorld;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment