added output for pion and electrons

parent fdb3e0d9
......@@ -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();
......@@ -113,7 +113,7 @@ int main(int argc,char** argv)
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
// delete visManager; //(delete this line too if you don't want image).
//delete visManager; //(delete this line too if you don't want image).
delete runManager;
}
......
......@@ -53,13 +53,15 @@ class B1EventAction : public G4UserEventAction
virtual void BeginOfEventAction(const G4Event* event);
virtual void EndOfEventAction(const G4Event* event);
void PrintParticles(std::map<const G4String, int>& container, std::ofstream& gamma, std::ofstream& mu,
std::ofstream& nu_e, std::ofstream& nu_mu, std::ofstream& e, G4double position);
std::ofstream& pi, std::ofstream& e, G4double position);
void WriteHistogram(const G4String name, G4int Detec);
void AddEdep(G4double edep) { fEdep += edep; };
G4double SetPosition(G4int detec);
private:
B1RunAction* fRunAction;
G4int mu_event;
G4int y;
G4double fEdep;
std::vector<G4double> dec_pos;
B1DetectorConstruction* detectorConstruction;
......
......@@ -80,8 +80,8 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//caracteristicas do cilíndro -> world
G4double raio_i = 0;
G4double raio_e = 50*km;
G4double h_detector = 0.5*mm;
G4double h = 50*km;
G4double h_detector = 1*mm;
G4double h = 55*km;
G4double theta_0 = 0.*deg;
G4double theta_f = 360.*deg;
//making world of vacuum
......@@ -115,7 +115,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
//making air materiais
//Nitrogen
G4int num_layers = 251;
G4int num_layers = 230;
G4double layer_delta_h = 2*h/num_layers;
std::vector<G4Material *> layers_material;
layers_material.reserve(num_layers);
......@@ -192,7 +192,7 @@ G4VPhysicalVolume* B1DetectorConstruction::Construct()
number_detectors = num_layers;
//Detetor no chão
G4double surf_size = 1*m;
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);
......@@ -243,10 +243,13 @@ logicalSurf->SetSensitiveDetector(sensitive);
//colocando cor vermelha para detectores
G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
//azul
G4VisAttributes* worldVisAtt2 = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
worldVisAtt1->SetVisibility(true);
worldVisAtt2->SetVisibility(false);
worldVisAtt2->SetVisibility(true);
/*
for(G4int i = 0; i < num_detector; i++) {
......@@ -255,9 +258,9 @@ logicalSurf->SetSensitiveDetector(sensitive);
*/
for(G4int i = 0; i < (num_layers); i++) {
air_layers[i]->SetVisAttributes(worldVisAtt2);
//detectors[i]->SetVisAttributes(worldVisAtt1);
detectors[i]->SetVisAttributes(worldVisAtt1);
}
logicalSurf->SetVisAttributes(worldVisAtt1);
//logicalSurf->SetVisAttributes(worldVisAtt1);
return physWorld;
}
......
......@@ -89,10 +89,9 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
std::ofstream gammafile("gamma.csv");
std::ofstream mu_file("mu.csv");
std::ofstream nu_e_file("nu_e.csv");
std::ofstream nu_mu_file("nu_mu.csv");
std::ofstream e_file("e.txt");
std::ofstream particles_file("particles.csv");
std::ofstream pi_file("pi.csv");
std::vector<G4int> col;
......@@ -125,10 +124,12 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
fparticles[name]++;
//WriteHistogram(name, 1);
}
PrintParticles(fparticles, gammafile, mu_file, nu_e_file, nu_mu_file, e_file, pos_detec);
PrintParticles(fparticles, gammafile, mu_file, pi_file, e_file, pos_detec);
fparticles.clear();
}
}
/*
G4int mu_num = 0;
col[num + 1] = SDman->GetCollectionID("SDs");
HitsCol[num + 1] = (B1HitsCollection*)(HCE->GetHC(col[num + 1]));
......@@ -141,36 +142,38 @@ void B1EventAction::EndOfEventAction(const G4Event* event)
if (name == "mu+" || name == "mu-") {
G4cout << "muuuuuuuuu" << G4endl;
mu_num++;
}
}
G4cout << mu_num << G4endl;
mu_event = mu_event + mu_num;
y = y + 1;
mu_number << y << " " << mu_event;
mu_num = 0;
*/
gammafile.close();
mu_file.close();
nu_e_file.close();
nu_mu_file.close();
particles_file.close();
pi_file.close();
e_file.close();
}
void B1EventAction::PrintParticles(std::map<const G4String, int>& container, std::ofstream& gamma, std::ofstream& mu,
std::ofstream& nu_e, std::ofstream& nu_mu, std::ofstream& e, G4double position) {
std::ofstream& pi, std::ofstream& e, G4double position) {
std::map<const G4String, int>::iterator it;
// G4cout << "Número de párticulas identificadas no detetor: " << G4endl;
G4bool isGamma, ismu, isnu_e_anti, isnu_mu_anti, is_e = false;
G4int n_e_minus, n_e_pl, n_mu_minus, n_mu_plus, n_nu_e, n_anti_nu_e, n_nu_mu, n_anti_nu_mu = 0;
G4bool isGamma, ismu, is_e, is_pi = false;
G4int n_e_minus, n_e_pl, n_mu_minus, n_mu_plus, n_pi_plus, n_pi_minus;
n_e_minus = 0;
n_e_pl = 0;
n_mu_minus = 0;
n_mu_plus = 0;
n_nu_e = 0;
n_anti_nu_e = 0;
n_nu_mu = 0;
n_anti_nu_mu = 0;
n_pi_plus = 0;
n_pi_minus = 0;
for(it = container.begin() ;it != container.end(); it ++)
{
G4cout << n_e_pl << G4endl;
......@@ -186,18 +189,6 @@ void B1EventAction::PrintParticles(std::map<const G4String, int>& container, std
} else if (it->first == "mu-") {
n_mu_minus = it->second;
ismu = true;
} else if (it->first == "nu_e") {
n_nu_e = it->second;
isnu_e_anti = true;
} else if (it->first == "anti_nu_e") {
n_anti_nu_e = it->second;
isnu_e_anti = true;
} else if (it->first == "nu_mu") {
n_nu_mu = it->second;
isnu_mu_anti = true;
} else if (it->first == "anti_nu_mu") {
n_anti_nu_mu = it->second;
isnu_mu_anti = true;
} else if (it->first == "e+") {
n_e_pl = it->second;
G4cout << "aa" << n_e_pl << G4endl;
......@@ -206,8 +197,15 @@ void B1EventAction::PrintParticles(std::map<const G4String, int>& container, std
n_e_minus = it->second;
G4cout << "aa" << n_e_minus << G4endl;
is_e = true;
} else if (it->first == "pi+") {
n_pi_plus = it->second;
is_pi = true;
} else if (it->first == "pi-") {
n_pi_minus = it->second;
is_pi = true;
}
}
}
if (!isGamma) {
gamma << 0 << " " << position << "\n";
......@@ -229,19 +227,11 @@ void B1EventAction::PrintParticles(std::map<const G4String, int>& container, std
G4cout << n << G4endl;
e << n << " " << position << "\n";
}
if (!isnu_e_anti) {
nu_e << 0 << " " << position << "\n";
} else {
G4int n = n_nu_e + n_anti_nu_e;
nu_e << n << " " << position << "\n";
}
if (!isnu_mu_anti) {
nu_mu << 0 << " " << position << "\n";
if(!is_pi) {
pi << 0 << " " << position << "\n";
} else {
G4int n = n_nu_mu + n_anti_nu_mu;
nu_mu << n << " " << position << "\n";
G4int n = n_pi_plus + n_pi_minus;
pi << n << " " << position << "\n";
}
}
......
......@@ -5,7 +5,7 @@
# Use these open statements to open selected visualization
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
/vis/open OGL
#
# Use this open statement to create an OpenInventor view:
#/vis/open OI
......
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