detector inside layer

parent 5a979de6
......@@ -79,8 +79,8 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//
//caracteristicas do cilíndro -> world
G4double raio_i = 0;
G4double raio_e = 1*km;
G4double h_detector = 1*cm;
G4double raio_e = 40*km;
G4double h_detector = 0.1*mm;
G4double h = 40*km;
G4double theta_0 = 0.*deg;
G4double theta_f = 360.*deg;
......@@ -115,7 +115,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//making air materiais
//Nitrogen
G4int num_layers = 250;
G4int num_layers = 4000;
G4double layer_delta_h = 2*h/num_layers;
std::vector<G4Material *> layers_material;
layers_material.reserve(num_layers);
......@@ -148,25 +148,42 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
mass_over.close();
std::vector<G4LogicalVolume* > air_layers;
std::vector<G4LogicalVolume* > detectors;
air_layers.reserve(num_layers);
detectors.reserve(num_layers);
G4Tubs* cilindro_ar = new G4Tubs("air_layer", raio_i, raio_e, layer_delta_h/2 , theta_0, theta_f);
G4Tubs* cilind_detector = new G4Tubs("detec", raio_i, raio_e, h_detector , theta_0, theta_f);
for(G4int j = 0; j < (num_layers - 1); j++) {
air_layers[j] = new G4LogicalVolume(cilindro_ar, //its solid
layers_material[j], //its material
"layer" + std::to_string(j + 1));
detectors[j] = new G4LogicalVolume(cilind_detector, //its solid
layers_material[j], //its material
"detector" + std::to_string(j + 1));
//calculing the position in relation to the mother volume
G4double positon = h - (layer_delta_h/2) - (layer_delta_h)*j;
new G4PVPlacement(0, //no rotation
G4ThreeVector(0,0,positon), //at (0,0,0)
air_layers[j], //its logical volume
("lay" + std::to_string(j + 1)), //its name
logicWorld, //its mother volume
false, //no boolean operation
j); //copynumber
j);
//copynumber
new G4PVPlacement(0, //no rotation
G4ThreeVector(0,0,0), //at (0,0,0)
detectors[j], //its logical volume
("detec" + std::to_string(j + 1)), //its name
air_layers[j], //its mother volume
false, //no boolean operation
j); //copynumber
}
G4double safe_distance = 0.02*m;
......@@ -182,35 +199,6 @@ G4double total_safe = h_detector + safe_distance;
delta = layer_delta_h;
/*
G4LogicalVolume* logicDetector = new G4LogicalVolume(detector, //its solid
world_mat, //its material
"logicDetector");
*/
/*
//Criando os Logical volume
logicDetector.reserve(num_detector);
for(G4int i=0; i < num_detector; i++) {
logicDetector[i] = new G4LogicalVolume(detector, //its solid
world_mat, //its material
"logicDetector" + std::to_string(i + 1));
positions.push_back(initial_pos + i*delta_h);
std::cout << positions[i] << '\n';
new G4PVPlacement(0, //no rotation
G4ThreeVector(0,0,positions[i]), //at (0,0,0)
logicDetector[i], //its logical volume
("detector" + std::to_string(i + 1)), //its name
logicWorld, //its mother volume
false, //no boolean operation
i //copy number
); //overlaps checking
}
*/
//Coloca os deteroes dentro do cilindro e coloca a sua posição em um vetor com push_back()
......@@ -223,7 +211,7 @@ logicDetector.reserve(num_detector);
G4String SDname = "SD" + std::to_string(i + 1);
auto sensitive = new B1SD(SDname);
sdman->AddNewDetector(sensitive);
air_layers[i]->SetSensitiveDetector(sensitive);
detectors[i]->SetSensitiveDetector(sensitive);
}
......@@ -242,6 +230,7 @@ logicDetector.reserve(num_detector);
*/
for(G4int i = 0; i < (num_layers - 1); i++) {
air_layers[i]->SetVisAttributes(worldVisAtt2);
detectors[i]->SetVisAttributes(worldVisAtt1);
}
return physWorld;
......
......@@ -87,13 +87,13 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
half_height = detectorConstruction->get_size();
variation = detectorConstruction->get_delta();
std::ofstream gammafile("gamma.txt");
std::ofstream mu_plusfile("mu+.txt");
std::ofstream mu_minusfile("mu-.txt");
std::ofstream nu_e_file("nu_e.txt");
std::ofstream nu_mu_file("nu_mu.txt");
std::ofstream anti_nu_e_file("anti_nu_e.txt");
std::ofstream anti_nu_mu_file("anti_nu_mu.txt");
std::ofstream gammafile("gamma.csv");
std::ofstream mu_plusfile("mu+.csv");
std::ofstream mu_minusfile("mu-.csv");
std::ofstream nu_e_file("nu_e.csv");
std::ofstream nu_mu_file("nu_mu.csv");
std::ofstream anti_nu_e_file("anti_nu_e.csv");
std::ofstream anti_nu_mu_file("anti_nu_mu.csv");
std::ofstream particles_file("particles.csv");
......
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