Commit fdb3e0d9 authored by Luis Gustavo Pereira's avatar Luis Gustavo Pereira

aaaa

parent eb08b1b8
Pipeline #1 failed with stages
......@@ -85,7 +85,7 @@ int main(int argc,char** argv)
// Initialize visualization
// (if you don't want the image, just delete the G4VisManager objetc and everything that concerns it)
// G4VisManager* visManager = new G4VisExecutive;
// G4VisManager* visManager = new G4VisExecutive;
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
// G4VisManager* visManager = new G4VisExecutive("Quiet");
// visManager->Initialize();
......
......@@ -115,7 +115,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//making air materiais
//Nitrogen
G4int num_layers = 201;
G4int num_layers = 251;
G4double layer_delta_h = 2*h/num_layers;
std::vector<G4Material *> layers_material;
layers_material.reserve(num_layers);
......@@ -126,7 +126,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
for(G4int j = 0; j < (num_layers - 1); j++) {
for(G4int j = 0; j < (num_layers); j++) {
//fazer if clause para verificar valor de delta h progressivamente.
//dependendo do h + delta_h -> parâmetros diferentes.
G4double density;
......@@ -154,7 +154,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
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++) {
for(G4int j = 0; j < (num_layers); j++) {
air_layers[j] = new G4LogicalVolume(cilindro_ar, //its solid
layers_material[j], //its material
"layer" + std::to_string(j + 1));
......@@ -189,9 +189,28 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
G4double safe_distance = 0.02*m;
//Coloque aqui o número de detetores
G4int num_detector = 32;
number_detectors = num_layers - 1;
number_detectors = num_layers;
//Detetor no chão
G4double surf_size = 1*m;
G4double pos_surf = layer_delta_h/2 - surf_size;
G4Tubs* surface_detec = new G4Tubs("surf_tubs", raio_i, raio_e, surf_size , theta_0, theta_f);
G4LogicalVolume* logicalSurf = new G4LogicalVolume(surface_detec, //its solid
layers_material[0], //its material
"surf_log");
new G4PVPlacement(0, //no rotation
G4ThreeVector(0,0,pos_surf), //at (0,0,0)
logicalSurf, //its logical volume
("detecsrf"), //its name
air_layers[0], //its mother volume
false, //no boolean operation
0); //copynumber
//UTILIZAR NÚMEROS QUE num_layers/num_detector = inteiro.
G4double total_safe = h_detector + safe_distance;
G4double delta_h = (2*h - 2*safe_distance - 4*h_detector)/(num_detector - 1);
......@@ -209,13 +228,17 @@ G4double total_safe = h_detector + safe_distance;
auto sdman = G4SDManager::GetSDMpointer();
for(G4int i = 0; i< (num_layers - 1); i++) {
for(G4int i = 0; i< (num_layers); i++) {
G4String SDname = "SD" + std::to_string(i + 1);
auto sensitive = new B1SD(SDname);
sdman->AddNewDetector(sensitive);
detectors[i]->SetSensitiveDetector(sensitive);
}
G4String SDname = "SDs";
auto sensitive = new B1SD(SDname);
sdman->AddNewDetector(sensitive);
logicalSurf->SetSensitiveDetector(sensitive);
//colocando cor vermelha para detectores
......@@ -223,17 +246,18 @@ G4double total_safe = h_detector + safe_distance;
G4VisAttributes* worldVisAtt2 = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
worldVisAtt1->SetVisibility(true);
worldVisAtt2->SetVisibility(true);
worldVisAtt2->SetVisibility(false);
/*
for(G4int i = 0; i < num_detector; i++) {
logicDetector[i]->SetVisAttributes(worldVisAtt1 );
}
*/
for(G4int i = 0; i < (num_layers - 1); i++) {
for(G4int i = 0; i < (num_layers); i++) {
air_layers[i]->SetVisAttributes(worldVisAtt2);
detectors[i]->SetVisAttributes(worldVisAtt1);
//detectors[i]->SetVisAttributes(worldVisAtt1);
}
logicalSurf->SetVisAttributes(worldVisAtt1);
return physWorld;
}
......
......@@ -98,8 +98,8 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
std::vector<G4int> col;
std::vector<B1HitsCollection*> HitsCol;
col.reserve(num);
HitsCol.reserve(num);
col.reserve(num + 1);
HitsCol.reserve(num + 1);
for(G4int i=0; i < num; i++) {
col[i] = SDman->GetCollectionID("SD" + std::to_string(i + 1));
......@@ -129,7 +129,23 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
fparticles.clear();
}
}
G4int mu_num = 0;
col[num + 1] = SDman->GetCollectionID("SDs");
HitsCol[num + 1] = (B1HitsCollection*)(HCE->GetHC(col[num + 1]));
int n_hit = HitsCol[num + 1]->entries();
G4cout << "surface detector has " << n_hit << "hits" << G4endl;
B1Hits* hit = new B1Hits;
for(int i1 = 0; i1 < n_hit; i1++) {
B1Hits* hit = (*HitsCol[num + 1])[i1];
const G4String name = hit->getParticleInTarget();
if (name == "mu+" || name == "mu-") {
G4cout << "muuuuuuuuu" << G4endl;
mu_num++;
}
}
G4cout << mu_num << G4endl;
mu_num = 0;
gammafile.close();
mu_file.close();
nu_e_file.close();
......
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