Commit ec130dfd authored by Warren's avatar Warren
Browse files

Long Chamber added

parent afdb4c23
Pipeline #124517 passed with stages
in 3 minutes and 19 seconds
......@@ -4,12 +4,13 @@
#include "Garfield/MediumMagboltz.hh"
#include "Garfield/TrackHeed.hh"
#include "Garfield/SolidTube.hh"
#include "Garfield/SolidBox.hh"
#include "Garfield/AvalancheMC.hh"
#include "Garfield/ViewSignal.hh"
#include "Garfield/ViewMedium.hh"
double GARFDRIFT(double energy, double t_start, G4ThreeVector start, G4ThreeVector delta_pos, double R, int Pad_start, double ID,
double ScoLength, double SegLength, double event, double raw_energy_check) {
double ScoLength, double SegLength, double event, double raw_energy_check, string shape) {
ofstream file;
/*
......@@ -17,7 +18,9 @@ double GARFDRIFT(double energy, double t_start, G4ThreeVector start, G4ThreeVect
file << raw_energy_check << "\t" << R << endl;
file.close();
*/
const double rWire = 1.2;
double rWire;
if(shape == "Cylindrical") rWire = 1.2;
if(shape == "Long_Chamber") rWire = -2.5;
const double rTube = 5.;
const double lTube = 25.19;
//TH1F *hist = new TH1F("","",1000,0,10000); // 10 ns bins
......@@ -30,6 +33,7 @@ double GARFDRIFT(double energy, double t_start, G4ThreeVector start, G4ThreeVect
//const double vWire = -730.;
const double vWire = -1000.;
//const double vWire = -584.7139; // ND run 4230 (2008)
//const double vWire = -603.6855; // ND run 4279 (2008), HV = 1241, R1 = 1, R2 = 2
const double vTube = 0.;
double x_start, y_start, z_start;
//double production_bias = 0.01;
......@@ -50,7 +54,8 @@ double GARFDRIFT(double energy, double t_start, G4ThreeVector start, G4ThreeVect
Garfield::MediumMagboltz* gas = new Garfield::MediumMagboltz();
Garfield::ViewMedium* mediumView = new Garfield::ViewMedium();
Garfield::GeometrySimple* geo = new Garfield::GeometrySimple();
Garfield::SolidTube* tube = new Garfield::SolidTube(0, 0, 0, 0, rTube, lTube/2);
Garfield::SolidTube* tube = new Garfield::SolidTube(0, 0, 0, 0, rTube, lTube/2);
Garfield::SolidBox* box = new Garfield::SolidBox(0, 0, 0, 3.47, 5.0, lTube/2);
Garfield::ComponentAnalyticField* cmp = new Garfield::ComponentAnalyticField();
Garfield::Sensor* sensor = new Garfield::Sensor();
Garfield::AvalancheMC* drift = new Garfield::AvalancheMC();
......@@ -69,19 +74,26 @@ double GARFDRIFT(double energy, double t_start, G4ThreeVector start, G4ThreeVect
//gas->LoadGasFile("he_90_co2_10_200mbar.gas");
//gas->LoadGasFile("ar_90_ch4_10.gas"); //atomic fraction in this case (P10).
//gas->LoadGasFile("he_90_co2_10_500mbar.gas"); //mass fraction in this case
//gas->LoadGasFile("he_90_co2_10_500mbar.gas"); //mass fraction in this case
//gas->LoadGasFile("he_90_co2_10_1bar.gas");
gas->LoadGasFile("he_90_co2_10_100mbar.gas");
//gas->LoadGasFile("he_90_co2_10_600mbar.gas");
//gas->LoadGasFile("he_90_co2_10_700mbar.gas");
gas->Initialise(true);
mediumView->SetMedium(gas);
geo->AddSolid(tube, gas);
if(shape == "Cylindrical") geo->AddSolid(tube, gas);
if(shape == "Long_Chamber") geo->AddSolid(box, gas);
cmp->SetGeometry(geo);
cmp->AddWire(0, 0, 2*rWire, vWire, "c");
cmp->AddTube(rTube, vTube, 0, "a");
if(shape == "Cylindrical") {
cmp->AddWire(0, 0, 2*rWire, vWire, "c");
cmp->AddTube(rTube, vTube, 0, "a");
}
if(shape == "Long_Chamber") {
cmp->AddPlaneY(-2.5,-500.,"c"); //CHANGE CATHODE AND ANODE VOLTAGE HERE (FOR LONG CHAMBER)
cmp->AddPlaneY(2.5,0.,"a");
}
sensor->AddComponent(cmp);
drift->SetSensor(sensor);
......@@ -95,8 +107,8 @@ double GARFDRIFT(double energy, double t_start, G4ThreeVector start, G4ThreeVect
y_start = start.y() + delta_pos.y()*randomize;
z_start = start.z() + delta_pos.z()*randomize;
/*
file.open("garf_electrons_start_RZ.dat", std::ios::app);
file << pow(pow(x_start,2)+pow(y_start,2),0.5) << "\t" << z_start << endl;
file.open("coord_check.dat", std::ios::app);
file << start.x() << "\t" << start.y() << "\t" << start.z() << x_start endl;
file.close();
*/
drift->DriftElectron(x_start, y_start, z_start, t_start);
......@@ -108,28 +120,34 @@ double GARFDRIFT(double energy, double t_start, G4ThreeVector start, G4ThreeVect
//drift->GetElectronEndPoint(np-1, x_end, y_end, z_end, t_end);
Pad_end = (int)((z_end + ScoLength / 2.) / SegLength ) + 1; //new Pad number
if(shape=="Cylindrical") {
if(x_end > 0 and y_end > 0) {
if(abs(x_end) > abs(y_end)) sector = 0;
if(abs(x_end) < abs(y_end)) sector = 1;
}
if(x_end < 0 and y_end > 0) {
if(abs(x_end) < abs(y_end)) sector = 2;
if(abs(x_end) > abs(y_end)) sector = 3;
}
if(x_end < 0 and y_end < 0) {
if(abs(x_end) > abs(y_end)) sector = 4;
if(abs(x_end) < abs(y_end)) sector = 5;
}
if(x_end > 0 and y_end < 0) {
if(abs(x_end) < abs(y_end)) sector = 6;
if(abs(x_end) > abs(y_end)) sector = 7;
if(x_end > 0 and y_end > 0) {
if(abs(x_end) > abs(y_end)) sector = 0;
if(abs(x_end) < abs(y_end)) sector = 1;
}
if(x_end < 0 and y_end > 0) {
if(abs(x_end) < abs(y_end)) sector = 2;
if(abs(x_end) > abs(y_end)) sector = 3;
}
if(x_end < 0 and y_end < 0) {
if(abs(x_end) > abs(y_end)) sector = 4;
if(abs(x_end) < abs(y_end)) sector = 5;
}
if(x_end > 0 and y_end < 0) {
if(abs(x_end) < abs(y_end)) sector = 6;
if(abs(x_end) > abs(y_end)) sector = 7;
}
}
if(shape=="Long_Chamber") sector = 0;
//if(pow(pow(x_end,2)+pow(y_end,2),0.5)>4.9) { //reached the anode
file.open("signal.dat", std::ios::app);
file << event << "\t" << ID << "\t" << sector << "\t" << Pad_end << "\t" << t_end << "\t" << pow(pow(x_start,2)+pow(y_start,2),0.5) << "\t" << pow(pow(x_end,2)+pow(y_end,2),0.5) << endl;
if(shape == "Cylindrical") file << event << "\t" << ID << "\t" << sector << "\t" << Pad_end << "\t" << t_end << "\t" << pow(pow(x_start,2)+pow(y_start,2),0.5) << "\t" << pow(pow(x_end,2)+pow(y_end,2),0.5) << endl;
if(shape == "Long_Chamber") file << event << "\t" << ID << "\t" << sector << "\t" << Pad_end << "\t" << z_end << "\t" << t_end << "\t" << y_start << "\t" << y_end << endl;
//file << event << "\t" << ID << "\t" << sector << "\t" << Pad_end << "\t" << t_end
file.close();
//}
......
......@@ -65,24 +65,16 @@ using namespace CLHEP;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace TACTIC_NS{
// Energy and time Resolution
//const double EnergyThreshold = 0.01*MeV;
//const double ResoTime = 17.*ns ;
//const double ResoEnergy = 1.0*MeV ;
// const double cathode_radius = 12.*mm;
const double drift_radius = 50.*mm;
const double anode_radius = 51.*mm;
const double active_length = 251.9*mm;
const double window_pos = 104.*mm; //from centre of TACTIC from https://elog.triumf.ca/Tactic/Documentation/18
const double window_radius = 12.*mm; //guess
const double window_width = 1.5e-03*mm;
//const double vacuum_pos = (active_length/2. + window_pos + window_width/2.)/2.*mm;
//const double vacuum_width = active_length/2. - window_pos - window_width/2.*mm;
const G4int NumberOfStrips = 60;
const int NumberOfStrips = 60;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// TACTIC Specific Method
TACTIC::TACTIC(){
......@@ -125,9 +117,9 @@ void TACTIC::AddDetector(double R, double Theta, double Phi, string Shape){
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4LogicalVolume* TACTIC::BuildCylindricalDetector(){
if(!m_CylindricalDetector){
G4Material* Cu = MaterialManager::getInstance()->GetMaterialFromLibrary("Cu");
// if(!m_CylindricalDetector){
// G4Material* Cu = MaterialManager::getInstance()->GetMaterialFromLibrary("Cu");
G4Material* Mylar = MaterialManager::getInstance()->GetMaterialFromLibrary("Mylar");
G4Material* Vacuum = MaterialManager::getInstance()->GetMaterialFromLibrary("G4_Galactic");
......@@ -165,37 +157,50 @@ G4LogicalVolume* TACTIC::BuildCylindricalDetector(){
cout << TACTIC_gas << endl;
G4Tubs* world_volume = new G4Tubs("world_volume",0,TACTIC_NS::drift_radius+1*mm,TACTIC_NS::active_length*0.5+1*mm,0,360*deg);
G4Tubs* window = new G4Tubs("window",0,TACTIC_NS::window_radius,TACTIC_NS::window_width*0.5,0,360*deg);
//G4Tubs* anode = new G4Tubs("anode",TACTIC_NS::drift_radius,TACTIC_NS::anode_radius,TACTIC_NS::active_length*0.5,0,360*deg);
G4Tubs* gas_cathode = new G4Tubs("gas_cathode",0,TACTIC_NS::window_radius,TACTIC_NS::window_pos-TACTIC_NS::window_width*0.5,0,360*deg); //window pos doesn't need halving
G4Tubs* gas_drift = new G4Tubs("gas_drift",TACTIC_NS::window_radius,TACTIC_NS::drift_radius,TACTIC_NS::active_length*0.5,0,360*deg);
G4UnionSolid* gas_volume = new G4UnionSolid("gas_volume",gas_cathode,gas_drift);
//G4Tubs* gas_volume = new G4Tubs("gas_volume",0,TACTIC_NS::drift_radius,TACTIC_NS::active_length*0.5,0,360*deg);
if(m_Shape[0] == "Cylindrical") {
G4Tubs* world_volume = new G4Tubs("world_volume",0,TACTIC_NS::drift_radius+1*mm,TACTIC_NS::active_length*0.5+1*mm,0,360*deg);
G4Tubs* window = new G4Tubs("window",0,TACTIC_NS::window_radius,TACTIC_NS::window_width*0.5,0,360*deg);
//G4Tubs* anode = new G4Tubs("anode",TACTIC_NS::drift_radius,TACTIC_NS::anode_radius,TACTIC_NS::active_length*0.5,0,360*deg);
G4Tubs* gas_cathode = new G4Tubs("gas_cathode",0,TACTIC_NS::window_radius,TACTIC_NS::window_pos-TACTIC_NS::window_width*0.5,0,360*deg); //window pos doesn't need halving
G4Tubs* gas_drift = new G4Tubs("gas_drift",TACTIC_NS::window_radius,TACTIC_NS::drift_radius,TACTIC_NS::active_length*0.5,0,360*deg);
G4UnionSolid* gas_volume = new G4UnionSolid("gas_volume",gas_cathode,gas_drift);
//G4Tubs* gas_volume = new G4Tubs("gas_volume",0,TACTIC_NS::drift_radius,TACTIC_NS::active_length*0.5,0,360*deg);
m_CylindricalDetector = new G4LogicalVolume(world_volume, Vacuum, "m_CylindricalDetector_log",0,0,0);
//anode_log = new G4LogicalVolume(anode, Cu, "anode_log", 0,0,0);
gas_volume_log = new G4LogicalVolume(gas_volume, TACTIC_gas, "gas_volume_log",0,0,0);
window_log = new G4LogicalVolume(window, Mylar, "window_log",0,0,0);
new G4PVPlacement(0,G4ThreeVector(0,0,0),gas_volume_log,"gas_volume_phys",m_CylindricalDetector,false,0);
//new G4PVPlacement(0,G4ThreeVector(0,0,0),anode_log,"anode_phys",m_CylindricalDetector,false,0,true);
new G4PVPlacement(0,G4ThreeVector(0,0,TACTIC_NS::window_pos),window_log,"window_phys1",m_CylindricalDetector,false,0,true);
new G4PVPlacement(0,G4ThreeVector(0,0,-TACTIC_NS::window_pos),window_log,"window_phys2",m_CylindricalDetector,false,0,true);
m_CylindricalDetector = new G4LogicalVolume(world_volume, Vacuum, "m_CylindricalDetector_log",0,0,0);
//anode_log = new G4LogicalVolume(anode, Cu, "anode_log", 0,0,0);
gas_volume_log = new G4LogicalVolume(gas_volume, TACTIC_gas, "gas_volume_log",0,0,0);
window_log = new G4LogicalVolume(window, Mylar, "window_log",0,0,0);
}
new G4PVPlacement(0,G4ThreeVector(0,0,0),gas_volume_log,"gas_volume_phys",m_CylindricalDetector,false,0);
//new G4PVPlacement(0,G4ThreeVector(0,0,0),anode_log,"anode_phys",m_CylindricalDetector,false,0,true);
new G4PVPlacement(0,G4ThreeVector(0,0,TACTIC_NS::window_pos),window_log,"window_phys1",m_CylindricalDetector,false,0,true);
new G4PVPlacement(0,G4ThreeVector(0,0,-TACTIC_NS::window_pos),window_log,"window_phys2",m_CylindricalDetector,false,0,true);
gas_volume_log->SetVisAttributes(m_VisGas);
if(m_Shape[0] == "Long_Chamber") {
G4Box* world_volume = new G4Box("world_volume",34.7,25.,TACTIC_NS::active_length/2.); //Pad width = 34.7 mm (2 rows of pads), LC drift = 50 mm
m_CylindricalDetector = new G4LogicalVolume(world_volume, Vacuum, "m_CylindricalDetector_log",0,0,0);
G4Box* gas_volume = new G4Box("gas_volume",34.7,25.,TACTIC_NS::active_length/2.);
gas_volume_log = new G4LogicalVolume(gas_volume, TACTIC_gas, "gas_volume_log",0,0,0);
new G4PVPlacement(0,G4ThreeVector(0,0,0),gas_volume_log,"gas_volume_phys",m_CylindricalDetector,false,0);
}
m_CylindricalDetector->SetVisAttributes(m_VisGas);
//anode_log->SetVisAttributes(m_VisGas);
gas_volume_log->SetVisAttributes(m_VisGas);
G4UserLimits *gas_volume_step = new G4UserLimits();
G4double maxStep = 0.1*mm;
gas_volume_step->SetMaxAllowedStep(maxStep);
gas_volume_log->SetUserLimits(gas_volume_step);
gas_volume_log->SetSensitiveDetector(m_Scorer);
}
return m_CylindricalDetector;
}
......@@ -219,7 +224,7 @@ void TACTIC::ReadConfiguration(NPL::InputParser parser){
cout << endl << "//// TACTIC " << i+1 << endl;
G4ThreeVector Pos = NPS::ConvertVector(blocks[i]->GetTVector3("POS","mm"));
string Shape = blocks[i]->GetString("Shape");
Shape = blocks[i]->GetString("Shape");
m_GasMaterial.push_back(blocks[i]->GetString("GasMaterial_1"));
m_GasMaterial.push_back(blocks[i]->GetString("GasMaterial_2"));
m_GasFraction.push_back(blocks[i]->GetInt("GasFraction_1"));
......@@ -272,11 +277,12 @@ void TACTIC::ConstructDetector(G4LogicalVolume* world){
if(!m_ReactionRegion){
G4ProductionCuts* ecut = new G4ProductionCuts();
ecut->SetProductionCut(1000,"e-"); //I think lowest is 900 eV for delta electron production, this is 1000 MeV to cut all electrons produced this way
ecut->SetProductionCut(1e06,"e-"); //I think lowest is 900 eV for delta electron production, this is 1e06 MeV to cut all electrons produced this way
m_ReactionRegion= new G4Region("NPSimulationProcess");
m_ReactionRegion->SetProductionCuts(ecut);
//m_ReactionRegion->AddRootLogicalVolume(gas_volume_log);
//m_ReactionRegion->AddRootLogicalVolume(m_CylindricalDetector);
if(m_Active == "windows") m_ReactionRegion->AddRootLogicalVolume(window_log);
if(m_Active == "gas") m_ReactionRegion->AddRootLogicalVolume(gas_volume_log);
}
......@@ -333,7 +339,7 @@ void TACTIC::ReadSensitive(const G4Event* event ){
}
file << Info[13] << endl;
}
LightHitMap->clear();
G4THitsMap<G4double*>* HeavyHitMap;
......@@ -349,7 +355,7 @@ void TACTIC::ReadSensitive(const G4Event* event ){
}
file << Info[13] << endl;
}
HeavyHitMap->clear();
G4THitsMap<G4double*>* BeamHitMap;
......@@ -380,7 +386,7 @@ void TACTIC::InitializeScorers() {
m_Scorer = CheckScorer("TACTICScorer",already_exist) ;
if(already_exist)
return ;
// Otherwise the scorer is initialised
NPL::InputParser input(NPOptionManager::getInstance()->GetReactionFile());
......@@ -389,19 +395,19 @@ void TACTIC::InitializeScorers() {
if(input.GetAllBlocksWithToken("TwoBodyReaction").size()>0) {
// NEED SEPERATE SCORERS FOR EACH PARTICLE! OTHERWISE SCORER JUST RETURNS OUTPUT FOR ONE PARTICLE WHEN THERE IS OVERLAP
G4VPrimitiveScorer* LightScorer = new TACTICScorer::Gas_Scorer("LightScorer",1,TACTIC_NS::active_length,(int)TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3);
G4VPrimitiveScorer* HeavyScorer = new TACTICScorer::Gas_Scorer("HeavyScorer",1,TACTIC_NS::active_length,(int)TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3);
G4VPrimitiveScorer* BeamScorer = new TACTICScorer::Gas_Scorer("BeamScorer",1,TACTIC_NS::active_length,(int)TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3);
G4VPrimitiveScorer* LightScorer = new TACTICScorer::Gas_Scorer("LightScorer",1,TACTIC_NS::active_length,TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3,Shape);
G4VPrimitiveScorer* HeavyScorer = new TACTICScorer::Gas_Scorer("HeavyScorer",1,TACTIC_NS::active_length,TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3,Shape);
G4VPrimitiveScorer* BeamScorer = new TACTICScorer::Gas_Scorer("BeamScorer",1,TACTIC_NS::active_length,TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3,Shape);
G4SDParticleFilter* LightFilter = new G4SDParticleFilter("LightFilter");
G4SDParticleFilter* HeavyFilter = new G4SDParticleFilter("HeavyFilter");
G4SDParticleFilter* BeamFilter = new G4SDParticleFilter("BeamFilter");
/*
cout << m_Reaction.GetParticle1()->GetName() << "\t" << m_Reaction.GetParticle1()->GetA() << "\t" << m_Reaction.GetParticle1()->GetZ() << endl;
cout << m_Reaction.GetParticle2()->GetName() << "\t" << m_Reaction.GetParticle2()->GetA() << "\t" << m_Reaction.GetParticle2()->GetZ() << endl;
cout << m_Reaction.GetParticle3()->GetName() << "\t" << m_Reaction.GetParticle3()->GetA() << "\t" << m_Reaction.GetParticle3()->GetZ() << endl;
cout << m_Reaction.GetParticle4()->GetName() << "\t" << m_Reaction.GetParticle4()->GetA() << "\t" << m_Reaction.GetParticle4()->GetZ() << endl;
*/
cout << m_Reaction.GetParticle1()->GetName() << "\t" << m_Reaction.GetParticle1()->GetA() << "\t" << m_Reaction.GetParticle1()->GetZ() << endl;
cout << m_Reaction.GetParticle2()->GetName() << "\t" << m_Reaction.GetParticle2()->GetA() << "\t" << m_Reaction.GetParticle2()->GetZ() << endl;
cout << m_Reaction.GetParticle3()->GetName() << "\t" << m_Reaction.GetParticle3()->GetA() << "\t" << m_Reaction.GetParticle3()->GetZ() << endl;
cout << m_Reaction.GetParticle4()->GetName() << "\t" << m_Reaction.GetParticle4()->GetA() << "\t" << m_Reaction.GetParticle4()->GetZ() << endl;
LightFilter->addIon(m_Reaction.GetParticle3()->GetZ(),m_Reaction.GetParticle3()->GetA());
HeavyFilter->addIon(m_Reaction.GetParticle4()->GetZ(),m_Reaction.GetParticle4()->GetA());
if(m_Reaction.GetParticle1()->GetZ() == m_Reaction.GetParticle4()->GetZ()) BeamFilter->add("geantino");
......@@ -419,9 +425,9 @@ void TACTIC::InitializeScorers() {
if(input.GetAllBlocksWithToken("Isotropic").size()>0) { //For alpha, proton or neutron source (obviously neutron wont do anything so this is spare).
G4VPrimitiveScorer* LightScorer = new TACTICScorer::Gas_Scorer("LightScorer",1,TACTIC_NS::active_length,(int)TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3);
G4VPrimitiveScorer* HeavyScorer = new TACTICScorer::Gas_Scorer("HeavyScorer",1,TACTIC_NS::active_length,(int)TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3);
G4VPrimitiveScorer* BeamScorer = new TACTICScorer::Gas_Scorer("BeamScorer",1,TACTIC_NS::active_length,(int)TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3);
G4VPrimitiveScorer* LightScorer = new TACTICScorer::Gas_Scorer("LightScorer",1,TACTIC_NS::active_length,TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3,Shape);
G4VPrimitiveScorer* HeavyScorer = new TACTICScorer::Gas_Scorer("HeavyScorer",1,TACTIC_NS::active_length,TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3,Shape);
G4VPrimitiveScorer* BeamScorer = new TACTICScorer::Gas_Scorer("BeamScorer",1,TACTIC_NS::active_length,TACTIC_NS::NumberOfStrips,0,m_p0,m_p1,m_p2,m_p3,Shape);
G4SDParticleFilter* LightFilter = new G4SDParticleFilter("LightFilter","alpha");
G4SDParticleFilter* HeavyFilter = new G4SDParticleFilter("HeavyFilter","proton");
G4SDParticleFilter* BeamFilter = new G4SDParticleFilter("BeamFilter","neutron");
......
......@@ -2,15 +2,16 @@
TACTIC
POS= 0 0 0 mm
Shape= Cylindrical
% Shape = Long_Chamber
% GasMaterial_1 = P10_gas
GasMaterial_1 = He_gas
GasMaterial_2 = G4_CARBON_DIOXIDE
GasFraction_1 = 90
GasFraction_2 = 10
Temperature = 293.15 kelvin
% Pressure = 2.0 bar
Pressure = 0.1 bar
% Pressure = 1.0 bar
Active = gas
Active = gas
p0 = 0
p1 = 0
p2 = 0
......
......@@ -42,6 +42,8 @@ using namespace std;
#include "Decay.hh"
#include "BeamReaction.hh"
extern double excess;
class TACTIC : public NPS::VDetector{
////////////////////////////////////////////////////
/////// Default Constructor and Destructor /////////
......@@ -65,7 +67,8 @@ private:
G4LogicalVolume* m_CylindricalDetector;
G4LogicalVolume* gas_volume_log;
G4LogicalVolume* window_log;
G4LogicalVolume* vacuum_log;
//G4LogicalVolume* window_log_2;
//G4LogicalVolume* vacuum_log;
////////////////////////////////////////////////////
////// Inherite from NPS::VDetector class /////////
////////////////////////////////////////////////////
......@@ -116,13 +119,16 @@ private: // Geometry
vector<string> m_Shape ;
string m_Active;
double m_p0, m_p1, m_p2, m_p3;
string Shape;
//int NumberOfStrips;
// Visualisation Attribute
G4VisAttributes* m_VisChamber;
G4VisAttributes* m_VisWindows;
G4VisAttributes* m_VisGas;
G4VisAttributes* m_VisVacuum;
private:
// Region were reaction can occure:
G4Region* m_ReactionRegion;
......@@ -131,6 +137,7 @@ private:
// Needed for dynamic loading of the library
public:
static NPS::VDetector* Construct();
};
#endif
......@@ -13,7 +13,7 @@ double excess;
using namespace TACTICScorer;
Gas_Scorer::Gas_Scorer(G4String name,G4int Level,G4double ScorerLength,G4int NumberOfSegments, G4int depth, G4double p0, G4double p1, G4double p2, G4double p3) //what do level and depth do?
Gas_Scorer::Gas_Scorer(G4String name,G4int Level,G4double ScorerLength,G4int NumberOfSegments, G4int depth, G4double p0, G4double p1, G4double p2, G4double p3,string Shape) //what do level and depth do?
:G4VPrimitiveScorer(name, depth),HCID(-1){
m_ScorerLength = ScorerLength;
m_NumberOfSegments = NumberOfSegments;
......@@ -26,6 +26,7 @@ Gas_Scorer::Gas_Scorer(G4String name,G4int Level,G4double ScorerLength,G4int Num
m_p1 = p1;
m_p2 = p2;
m_p3 = p3;
m_Shape = Shape;
}
Gas_Scorer::~Gas_Scorer(){}
......@@ -35,7 +36,7 @@ G4bool Gas_Scorer::ProcessHits(G4Step* aStep, G4TouchableHistory*){
G4double* Infos = new G4double[15];
//bool first_step = true;
m_Position = aStep->GetPreStepPoint()->GetPosition();
Infos[0] = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
Infos[1] = aStep->GetTrack()->GetTrackID();
......@@ -50,7 +51,8 @@ G4bool Gas_Scorer::ProcessHits(G4Step* aStep, G4TouchableHistory*){
Infos[6] = m_SegmentNumber;
//prepad = Infos[6];
Infos[7] = m_Position.z();
Infos[8] = pow(pow(m_Position.x(),2) + pow(m_Position.y(),2),0.5); //R
if(m_Shape == "Cylindrical") Infos[8] = pow(pow(m_Position.x(),2) + pow(m_Position.y(),2),0.5); //R
if(m_Shape == "Long_Chamber") Infos[8] = m_Position.y();
Infos[9] = aStep->GetTrack()->GetVertexPosition()[2];
Infos[10] = aStep->GetTrack()->GetVertexKineticEnergy();
G4ThreeVector p_vec = aStep->GetTrack()->GetVertexMomentumDirection();
......@@ -82,7 +84,7 @@ G4bool Gas_Scorer::ProcessHits(G4Step* aStep, G4TouchableHistory*){
#ifdef USE_Garfield
Infos[14] = GARFDRIFT(((aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit())/eV+excess), Infos[3], m_Position/cm, delta_Position/cm, Infos[8]/cm, Infos[6], Infos[2], m_ScorerLength/cm, m_SegmentLength/cm, Infos[0], (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit())/eV)*eV;
Infos[14] = GARFDRIFT(((aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit())/eV+excess), Infos[3], m_Position/cm, delta_Position/cm, Infos[8]/cm, Infos[6], Infos[2], m_ScorerLength/cm, m_SegmentLength/cm, Infos[0], (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit())/eV, m_Shape)*eV;
/*
file.open("excess_test.dat",std::ios::app);
file << Infos[6] << "\t" << "\t" << aStep->IsFirstStepInVolume() << "\t" << excess << "\t" << Infos[14]/eV << "\t" << (int)((((aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit())/eV+excess) / 41.1)*0.01) << "\t" << Infos[8] << endl;
......
......@@ -21,7 +21,8 @@ namespace TACTICScorer {
G4double p0 = 0,
G4double p1 = 0,
G4double p2 = 0,
G4double p3 = 0
G4double p3 = 0,
string Shape = "default"
);
~Gas_Scorer();
......@@ -47,6 +48,7 @@ namespace TACTICScorer {
G4double m_p1;
G4double m_p2;
G4double m_p3;
string m_Shape;
ofstream file;
// G4double excess;
......
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