uniform magnetic field added

parent 36559b88
...@@ -40,6 +40,9 @@ class B1SD; ...@@ -40,6 +40,9 @@ class B1SD;
class G4VPhysicalVolume; class G4VPhysicalVolume;
class G4LogicalVolume; class G4LogicalVolume;
class G4VSensitiveDetector; class G4VSensitiveDetector;
class G4PVPlacement;
class G4Tubs;
class G4Material;
using namespace std; using namespace std;
/// Detector construction class to define materials and geometry. /// Detector construction class to define materials and geometry.
...@@ -51,6 +54,7 @@ class B1DetectorConstruction : public G4VUserDetectorConstruction ...@@ -51,6 +54,7 @@ class B1DetectorConstruction : public G4VUserDetectorConstruction
virtual ~B1DetectorConstruction(); virtual ~B1DetectorConstruction();
virtual G4VPhysicalVolume* Construct(); virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; } G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
G4LogicalVolume* GetScoringDetector() const { return fScoringDetector; } G4LogicalVolume* GetScoringDetector() const { return fScoringDetector; }
...@@ -61,12 +65,29 @@ class B1DetectorConstruction : public G4VUserDetectorConstruction ...@@ -61,12 +65,29 @@ class B1DetectorConstruction : public G4VUserDetectorConstruction
std::vector<G4double>& GetPositions() { std::vector<G4double>& GetPositions() {
return positions;} return positions;}
/*
struct detector_air {
G4String name;
G4double position;
G4LogicalVolume* detector = new G4LogicalVolume(detector, world_mat, name);
G4PVPlacement* place = new G4PVPlacement(0,
G4ThreeVector(0,0,(position)),
detector,
name,
fScoringVolume,
false,
1,
checkOverlaps);
};
*/
protected: protected:
G4LogicalVolume* fScoringVolume; G4LogicalVolume* fScoringVolume;
G4LogicalVolume* fScoringDetector; G4LogicalVolume* fScoringDetector;
G4LogicalVolume* logicWorld;
std::vector<G4double> positions; std::vector<G4double> positions;
G4double delta; G4double delta;
G4double size; G4double size;
G4Tubs* detector;
}; };
......
...@@ -43,7 +43,9 @@ ...@@ -43,7 +43,9 @@
#include "G4SystemOfUnits.hh" #include "G4SystemOfUnits.hh"
#include "G4VSensitiveDetector.hh" #include "G4VSensitiveDetector.hh"
#include "G4Track.hh" #include "G4Track.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...@@ -82,9 +84,10 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct() ...@@ -82,9 +84,10 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
G4double theta_f = 360.*deg; G4double theta_f = 360.*deg;
G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR"); G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
G4Tubs* cilindro = new G4Tubs("world", raio_i, raio_e, h, theta_0, theta_f); G4Tubs* cilindro = new G4Tubs("world", raio_i, raio_e, h, theta_0, theta_f);
G4LogicalVolume* logicWorld = logicWorld =
new G4LogicalVolume(cilindro, //its solid new G4LogicalVolume(cilindro, //its solid
world_mat, //its material world_mat, //its material
"World"); //its name "World"); //its name
...@@ -107,7 +110,8 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct() ...@@ -107,7 +110,8 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//Criando os Logical volume //Criando os Logical volume
G4Tubs* detector = new G4Tubs("detector", raio_i, raio_e, h_detector, theta_0, theta_f);
detector = new G4Tubs("detector", raio_i, raio_e, h_detector, theta_0, theta_f);
G4LogicalVolume* logicDetector1 = new G4LogicalVolume(detector, G4LogicalVolume* logicDetector1 = new G4LogicalVolume(detector,
...@@ -270,6 +274,9 @@ positions.push_back(pos1); ...@@ -270,6 +274,9 @@ positions.push_back(pos1);
1, 1,
checkOverlaps); checkOverlaps);
//MELHORAR aqui
G4double pos2 = (initial_pos + delta_h); G4double pos2 = (initial_pos + delta_h);
positions.push_back(pos2); positions.push_back(pos2);
new G4PVPlacement(0, new G4PVPlacement(0,
...@@ -659,6 +666,7 @@ new G4PVPlacement(0, ...@@ -659,6 +666,7 @@ new G4PVPlacement(0,
auto sdman = G4SDManager::GetSDMpointer(); auto sdman = G4SDManager::GetSDMpointer();
G4String SDname1; G4String SDname1;
auto sensitive1 = new B1SD(SDname1 = "SD1"); auto sensitive1 = new B1SD(SDname1 = "SD1");
sdman->AddNewDetector(sensitive1); sdman->AddNewDetector(sensitive1);
...@@ -822,13 +830,12 @@ G4String SDname17; ...@@ -822,13 +830,12 @@ G4String SDname17;
logicDetector32->SetSensitiveDetector(sensitive32); logicDetector32->SetSensitiveDetector(sensitive32);
//colocando cor vermelha para detectores //colocando cor vermelha para detectores
G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0)); G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
worldVisAtt1->SetVisibility(true); worldVisAtt1->SetVisibility(true);
logicDetector1->SetVisAttributes(worldVisAtt1);
logicDetector2->SetVisAttributes(worldVisAtt1); logicDetector2->SetVisAttributes(worldVisAtt1);
logicDetector3->SetVisAttributes(worldVisAtt1); logicDetector3->SetVisAttributes(worldVisAtt1);
logicDetector4->SetVisAttributes(worldVisAtt1); logicDetector4->SetVisAttributes(worldVisAtt1);
...@@ -861,8 +868,17 @@ G4String SDname17; ...@@ -861,8 +868,17 @@ G4String SDname17;
logicDetector31->SetVisAttributes(worldVisAtt1); logicDetector31->SetVisAttributes(worldVisAtt1);
logicDetector32->SetVisAttributes(worldVisAtt1); logicDetector32->SetVisAttributes(worldVisAtt1);
return physWorld; return physWorld;
} }
void B1DetectorConstruction::ConstructSDandField() {
//creanting uniform magnetic field
G4MagneticField* magField = new G4UniformMagField(G4ThreeVector(.0000005*LT,0.,0.));
G4FieldManager* FieldMgr =new G4FieldManager(magField);
logicWorld->SetFieldManager(FieldMgr, true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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