Commit 6e81a114 authored by Marcos Derós's avatar Marcos Derós

aa

parent ff67dec0
......@@ -35,6 +35,7 @@
#include "globals.hh"
#include "G4VisAttributes.hh"
#include <vector>
#include <cmath>
class B1SD;
class G4VPhysicalVolume;
......@@ -63,6 +64,9 @@ class B1DetectorConstruction : public G4VUserDetectorConstruction
G4double get_delta(){return delta;}
G4double get_size() {return size;}
G4double GetDetecPos(G4int num_detec);
G4double density_function(G4double a_i, G4double b_i, G4double c_i, G4double h) {
return (a_i + b_i*exp(-h/c_i));
}
std::vector<G4double>& GetPositions() {
return positions;}
......
......@@ -69,30 +69,6 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
// Get nist material manager
G4NistManager* nist = G4NistManager::Instance();
//making air materiais
//Nitrogen
G4double a_N = 14.01*g/mole;
G4String name, symbol;
G4double z;
G4Element* ele_N = new G4Element(name="Nitrogen", symbol="N", z=7., a_N);
//Oxygen
G4double a_o = 16.00*g/mole;
G4Element* ele_O = new G4Element(name="Oxygen", symbol="O", z=8., a_o);
//Argon
G4double a_Ar = 39.948*g/mole;
G4Element* ele_Ar = new G4Element(name="Argon", symbol="Ar", z=18., a_Ar);
G4int num_layers;
G4double altitude = 100*km;
G4double layer_delta_h = num_layers/altitude;
std::vector<G4Material *> layers_material;
layers_material.reserve(num_layers);
for(G4int i = 0; i < num_layers; i++) {
//fazer if clause para verificar valor de delta h progressivamente.
//dependendo do h + delta_h -> parâmetros diferentes.
}
// Option to switch on/off checking of volumes overlaps
//
......@@ -103,9 +79,9 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//
//caracteristicas do cilíndro -> world
G4double raio_i = 0;
G4double raio_e = 50*m;
G4double raio_e = 70*m;
G4double h_detector = 1*cm;
G4double h = 100*m;
G4double h = 200*m;
G4double theta_0 = 0.*deg;
G4double theta_f = 360.*deg;
//making world of vacuum
......@@ -134,12 +110,70 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//
fScoringVolume = logicWorld;
//começar aqui os layers da atmosfera em um for semelhante ao dos detetores, porém grudados e preenchendo todo o cilindro.
//making air materiais
//Nitrogen
G4double a_N = 14.01*g/mole;
G4String name, symbol;
G4double z;
G4Element* ele_N = new G4Element(name="Nitrogen", symbol="N", z=7., a_N);
//Oxygen
G4double a_o = 16.00*g/mole;
G4Element* ele_O = new G4Element(name="Oxygen", symbol="O", z=8., a_o);
//Argon
G4double a_Ar = 39.948*g/mole;
G4Element* ele_Ar = new G4Element(name="Argon", symbol="Ar", z=18., a_Ar);
G4int num_layers = 200;
G4double layer_delta_h = 2*h/num_layers;
std::vector<G4Material *> layers_material;
layers_material.reserve(num_layers);
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;
G4double atm_position = layer_delta_h*j;
if (atm_position >= 0*km && atm_position < 4*km) {
density = density_function(-86.5562, 1222.6562, 994186.38, atm_position);
G4cout << "a" << G4endl;
} else if (atm_position >= 4*km && atm_position < 10*km) {
density = density_function(-94.919, 1144.9069, 878153.55, atm_position);
G4cout << "b" << G4endl;
} else if (atm_position >= 10*km && atm_position < 40*km) {
G4cout << "c" << G4endl;
density = density_function(0.61289, 1305.5948, 636143.04, atm_position);
} else if (atm_position >= 40*km && atm_position < 100*km) {
G4cout << "d" << G4endl;
density = density_function(0.0, 540.1778, 772170.16, atm_position);
}
G4cout << density << G4endl;
G4cout << j << G4endl;
layers_material[j] = new G4Material(name="Air" + std::to_string(j), density, 3);
layers_material[j]->AddElement(ele_N, 78.1*perCent);
layers_material[j]->AddElement(ele_O, 21.0*perCent);
layers_material[j]->AddElement(ele_Ar, 0.9*perCent);
}
std::vector<G4LogicalVolume* > air_layers;
air_layers.reserve(num_layers);
G4Tubs* cilindro_ar = new G4Tubs("air_layer", raio_i, raio_e, layer_delta_h/2 , theta_0, theta_f);
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));
//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
}
G4double safe_distance = 0.02*m;
//Coloque aqui o número de detetores
G4int num_detector = 32;
......@@ -161,6 +195,7 @@ G4double total_safe = h_detector + safe_distance;
"logicDetector");
*/
/*
//Criando os Logical volume
logicDetector.reserve(num_detector);
for(G4int i=0; i < num_detector; i++) {
......@@ -177,8 +212,8 @@ logicDetector.reserve(num_detector);
("detector" + std::to_string(i + 1)), //its name
logicWorld, //its mother volume
false, //no boolean operation
i, //copy number
checkOverlaps); //overlaps checking
i //copy number
); //overlaps checking
}
......@@ -198,13 +233,22 @@ logicDetector.reserve(num_detector);
logicDetector[i]->SetSensitiveDetector(sensitive);
}
*/
//colocando cor vermelha para detectores
G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
G4VisAttributes* worldVisAtt2 = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
worldVisAtt1->SetVisibility(true);
worldVisAtt2->SetVisibility(true);
/*
for(G4int i = 0; i < num_detector; i++) {
logicDetector[i]->SetVisAttributes(worldVisAtt1 );
}
*/
for(G4int i = 0; i < num_layers; i++) {
air_layers[i]->SetVisAttributes(worldVisAtt2);
}
return physWorld;
......
......@@ -95,6 +95,7 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
std::ofstream anti_nu_e_file("anti_nu_e.txt");
std::ofstream anti_nu_mu_file("anti_nu_mu.txt");
/*
std::vector<G4int> col;
std::vector<B1HitsCollection*> HitsCol;
......@@ -125,7 +126,7 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
fparticles.clear();
}
}
*/
gammafile.close();
mu_plusfile.close();
mu_minusfile.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