diff --git a/NPSimulation/Detectors/Vamos/Vamos.cc b/NPSimulation/Detectors/Vamos/Vamos.cc index 586262abd8747e0fac9e112f58ac40796e2648f7..67c2386f5cc03fbf1a8a8715e572ef1fd15c7c80 100644 --- a/NPSimulation/Detectors/Vamos/Vamos.cc +++ b/NPSimulation/Detectors/Vamos/Vamos.cc @@ -59,42 +59,52 @@ using namespace CLHEP; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... namespace Vamos_NS { - // Energy,time and position Resolution - const G4double EnergyThreshold = -10 * MeV; - const G4double ResoTime = 4.5 * ns; - const G4double ResoEnergy = 0.0001 * MeV; - const G4double ResoDriftTime = 0.0001 * ns; - const G4double ResoPosX = 0.0001 * mm; - - // Drift features - const G4double DriftSpeed = 1 * cm / microsecond; - const G4ThreeVector DriftDir = G4ThreeVector(0, 1, 0); - - // Geometry - const G4double E_DCWidth = 600 * mm; // Entrance_DriftChamber - const G4double E_DCLength = 150 * mm; - const G4double E_DCThickness = 60 * mm; - - const G4double MagnetWidth = 1000 * mm; - const G4double MagnetLenght = 150 * mm; - const G4double MagnetThickness = 200 * mm; - const G4double DipolThickness = 600 * mm; - - const G4double ChamberWidth = 1000 * mm; - const G4double ChamberLength = 150 * mm; - const G4double ChamberThickness = 120 * mm; - - // Mother Volume of Vamos - const G4double Phi = 0 * deg; - const G4double VamosVolumeWidth = 4500 * mm; - const G4double VamosVolumeLength = 1000 * mm; - const G4double VamosVolumeThickness = 5000 * mm; - - // SubVolume of detection - const G4double DetectionVolumeThickness = 1300 * mm; - const G4double DetectionVolumeWidth = 1000 * mm; - const G4double DetectionVolumeLength = 1000 * mm; - const G4double Det_Theta = 45 * deg; + // Energy,time and position Resolution + const G4double EnergyThreshold = -10 * MeV; + const G4double ResoTime = 4.5 * ns; + const G4double ResoEnergy = 0.0001 * MeV; + const G4double ResoDriftTime = 0.0001 * ns; + const G4double ResoPosX = 0.0001 * mm; + + // Drift features + const G4double DriftSpeed = 1 * cm / microsecond; + const G4ThreeVector DriftDir = G4ThreeVector(0, 1, 0); + + // Geometry + const G4double E_DCWidth = 600 * mm; // Entrance_DriftChamber + const G4double E_DCLength = 150 * mm; + const G4double E_DCThickness = 60 * mm; + + const G4double MagnetWidth = 1000 * mm; + const G4double MagnetLenght = 150 * mm; + const G4double MagnetThickness = 200 * mm; + const G4double DipolThickness = 600 * mm; + + const G4double ChamberWidth = 1000 * mm; + const G4double ChamberLength = 150 * mm; + const G4double ChamberThickness = 120 * mm; + + // Mother Volume of Vamos + const G4double Phi = 0 * deg; + const G4double VamosVolumeWidth = 4500 * mm; + const G4double VamosVolumeLength = 1000 * mm; + const G4double VamosVolumeThickness = 5000 * mm; + + // SubVolume of detection + const G4double DetectionVolumeThickness = 1300 * mm; + const G4double DetectionVolumeWidth = 1000 * mm; + const G4double DetectionVolumeLength = 1000 * mm; + const G4double Det_Theta = 45 * deg; + + // TMW1-2 + const G4double TMW1_Width = 40 * mm; + const G4double TMW1_Length = 61 * mm; + const G4double TMW1_Thickness = 5 * mm; + + const G4double TMW2_Width = 65 * mm; + const G4double TMW2_Length = 93 * mm; + const G4double TMW2_Thickness = 5 * mm; + } @@ -105,28 +115,31 @@ namespace Vamos_NS { // Vamos Specific Method Vamos::Vamos() { - m_Event = new TVamosData(); - m_CalorimeterScorer = 0; - m_DCScorer = 0; - m_Quad1 = 0; - m_Quad2 = 0; - m_Dipol = 0; - m_BeamCatcher = 0; - m_MWPPAC = 0; - m_DC3 = 0; - m_DC4 = 0; - m_DC1 = 0; - m_DC2 = 0; - - ICcounter = 0; - - // RGB Color + Transparency - m_VisQuad = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0)); - m_VisVolumeVamos = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0, 0.1)); - m_VisDC = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0, 0.2)); - m_VisCatcher = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0)); - m_VisGasC4H10 = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0, 0.2)); - m_VisGasCF4 = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0, 0.2)); + m_Event = new TVamosData(); + m_CalorimeterScorer = 0; + m_DCScorer = 0; + m_TMW1Scorer = 0; + m_Quad1 = 0; + m_Quad2 = 0; + m_Dipol = 0; + m_BeamCatcher = 0; + m_TMW1 = 0; + m_TMW2 = 0; + m_MWPPAC = 0; + m_DC3 = 0; + m_DC4 = 0; + m_DC1 = 0; + m_DC2 = 0; + + ICcounter = 0; + + // RGB Color + Transparency + m_VisQuad = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0)); + m_VisVolumeVamos = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0, 0.1)); + m_VisDC = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0, 0.2)); + m_VisCatcher = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0)); + m_VisGasC4H10 = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0, 0.2)); + m_VisGasCF4 = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0, 0.2)); } Vamos::~Vamos() {} @@ -135,200 +148,250 @@ Vamos::~Vamos() {} using namespace Vamos_NS; +///////////////////////////////////////////////////////////////////// void Vamos::AddVamos(G4double R, double Theta) { - m_R = R; - m_Theta = Theta; + m_R = R; + m_Theta = Theta; } +///////////////////////////////////////////////////////////////////// void Vamos::AddBeamCatcher(string Material, G4double Width, double Length, - double Thickness, G4ThreeVector Pos) { - CatcherMaterial = Material; - CatcherWidth = Width; - CatcherLength = Length; - CatcherThickness = Thickness; - R_Catcher = Pos[2]; - Pos[2] = -DetectionVolumeThickness * 0.5 + CatcherThickness * 0.5; - m_PosCatcher = Pos; + double Thickness, G4ThreeVector Pos) { + CatcherMaterial = Material; + CatcherWidth = Width; + CatcherLength = Length; + CatcherThickness = Thickness; + R_Catcher = Pos[2]; + Pos[2] = -DetectionVolumeThickness * 0.5 + CatcherThickness * 0.5; + m_PosCatcher = Pos; } // To add DriftChambers and the MWPPAC +///////////////////////////////////////////////////////////////////// void Vamos::AddDetector(G4double Z, string Gas, double Pressure, - double Temperature) { - m_Z.push_back(Z); - m_Gas.push_back(Gas); - m_Pressure.push_back(Pressure); - m_Temperature.push_back(Temperature); + double Temperature) { + m_Z.push_back(Z); + m_Gas.push_back(Gas); + m_Pressure.push_back(Pressure); + m_Temperature.push_back(Temperature); } +///////////////////////////////////////////////////////////////////// void Vamos::AddIC(G4double Z, double Thickness, string Gas, double Pressure, - double Temperature) { - m_ZIC.push_back(Z); - m_ThicknessIC.push_back(Thickness); - m_GasIC.push_back(Gas); - m_PressureIC.push_back(Pressure); - m_TemperatureIC.push_back(Temperature); + double Temperature) { + m_ZIC.push_back(Z); + m_ThicknessIC.push_back(Thickness); + m_GasIC.push_back(Gas); + m_PressureIC.push_back(Pressure); + m_TemperatureIC.push_back(Temperature); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... // The two entry DriftChambers +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildDC1() { - if (!m_DC1) { - G4Box* box = new G4Box("Vamos_DC1", E_DCWidth * 0.5, E_DCLength * 0.5, - E_DCThickness * 0.5); - - G4Material* DetectorMaterial - = MaterialManager::getInstance()->GetGasFromLibrary( - m_Gas[0], m_Pressure[0], m_Temperature[0]); - - m_DC1 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC1", 0, 0, - 0); - m_DC1->SetVisAttributes(m_VisGasC4H10); - m_DC1->SetSensitiveDetector(m_DCScorer); - } - return m_DC1; + if (!m_DC1) { + G4Box* box = new G4Box("Vamos_DC1", E_DCWidth * 0.5, E_DCLength * 0.5, + E_DCThickness * 0.5); + + G4Material* DetectorMaterial + = MaterialManager::getInstance()->GetGasFromLibrary( + m_Gas[0], m_Pressure[0], m_Temperature[0]); + + m_DC1 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC1", 0, 0, + 0); + m_DC1->SetVisAttributes(m_VisGasC4H10); + m_DC1->SetSensitiveDetector(m_DCScorer); + } + return m_DC1; } +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildDC2() { - if (!m_DC2) { - G4Box* box = new G4Box("Vamos_DC2", E_DCWidth * 0.5, E_DCLength * 0.5, - E_DCThickness * 0.5); - - G4Material* DetectorMaterial - = MaterialManager::getInstance()->GetGasFromLibrary( - m_Gas[1], m_Pressure[1], m_Temperature[1]); - - m_DC2 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC2", 0, 0, - 0); - m_DC2->SetVisAttributes(m_VisGasC4H10); - m_DC2->SetSensitiveDetector(m_DCScorer); - } - return m_DC2; + if (!m_DC2) { + G4Box* box = new G4Box("Vamos_DC2", E_DCWidth * 0.5, E_DCLength * 0.5, + E_DCThickness * 0.5); + + G4Material* DetectorMaterial + = MaterialManager::getInstance()->GetGasFromLibrary( + m_Gas[1], m_Pressure[1], m_Temperature[1]); + + m_DC2 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC2", 0, 0, + 0); + m_DC2->SetVisAttributes(m_VisGasC4H10); + m_DC2->SetSensitiveDetector(m_DCScorer); + } + return m_DC2; } // Quadruples and Dipole just to make the visualisation nice +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildQuad1() { - if (!m_Quad1) { - G4Box* box = new G4Box("Vamos_Box", Vamos_NS::MagnetWidth * 0.5, - Vamos_NS::MagnetLenght * 0.5, - Vamos_NS::MagnetThickness * 0.5); - - G4Material* VamosMaterial - = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); - m_Quad1 = new G4LogicalVolume(box, VamosMaterial, "logic_Quad1", 0, 0, 0); - m_Quad1->SetVisAttributes(m_VisQuad); - } - return m_Quad1; + if (!m_Quad1) { + G4Box* box = new G4Box("Vamos_Box", Vamos_NS::MagnetWidth * 0.5, + Vamos_NS::MagnetLenght * 0.5, + Vamos_NS::MagnetThickness * 0.5); + + G4Material* VamosMaterial + = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); + m_Quad1 = new G4LogicalVolume(box, VamosMaterial, "logic_Quad1", 0, 0, 0); + m_Quad1->SetVisAttributes(m_VisQuad); + } + return m_Quad1; } +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildQuad2() { - if (!m_Quad2) { - G4Box* box = new G4Box("Vamos_Quad2", Vamos_NS::MagnetWidth * 0.5, - Vamos_NS::MagnetLenght * 0.5, - Vamos_NS::MagnetThickness * 0.5); - - G4Material* VamosMaterial - = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); - m_Quad1 = new G4LogicalVolume(box, VamosMaterial, "logic_Quad1", 0, 0, 0); - m_Quad1->SetVisAttributes(m_VisQuad); - } - return m_Quad1; + if (!m_Quad2) { + G4Box* box = new G4Box("Vamos_Quad2", Vamos_NS::MagnetWidth * 0.5, + Vamos_NS::MagnetLenght * 0.5, + Vamos_NS::MagnetThickness * 0.5); + + G4Material* VamosMaterial + = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); + m_Quad1 = new G4LogicalVolume(box, VamosMaterial, "logic_Quad1", 0, 0, 0); + m_Quad1->SetVisAttributes(m_VisQuad); + } + return m_Quad1; } +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildDipol() { - if (!m_Dipol) { - G4Box* box = new G4Box("Vamos_Dipol", Vamos_NS::MagnetWidth * 0.5, - Vamos_NS::MagnetLenght * 0.5, - Vamos_NS::DipolThickness * 0.5); - - G4Material* VamosMaterial - = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); - m_Dipol = new G4LogicalVolume(box, VamosMaterial, "logic_Dipol", 0, 0, 0); - m_Dipol->SetVisAttributes(m_VisQuad); - } - return m_Dipol; + if (!m_Dipol) { + G4Box* box = new G4Box("Vamos_Dipol", Vamos_NS::MagnetWidth * 0.5, + Vamos_NS::MagnetLenght * 0.5, + Vamos_NS::DipolThickness * 0.5); + + G4Material* VamosMaterial + = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); + m_Dipol = new G4LogicalVolume(box, VamosMaterial, "logic_Dipol", 0, 0, 0); + m_Dipol->SetVisAttributes(m_VisQuad); + } + return m_Dipol; } // Detection at the end of Vamos +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildBeamCatcher() { - if (!m_BeamCatcher) { - G4Box* box = new G4Box("Vamos_Catcher", CatcherWidth * 0.5, - CatcherLength * 0.5, CatcherThickness * 0.5); - - G4Material* Material - = MaterialManager::getInstance()->GetMaterialFromLibrary( - CatcherMaterial); - m_BeamCatcher - = new G4LogicalVolume(box, Material, "logic_Vamos_Catcher", 0, 0, 0); - m_BeamCatcher->SetVisAttributes(m_VisCatcher); - m_BeamCatcher->SetSensitiveDetector(m_CalorimeterScorer); - } - return m_BeamCatcher; + if (!m_BeamCatcher) { + G4Box* box = new G4Box("Vamos_Catcher", CatcherWidth * 0.5, + CatcherLength * 0.5, CatcherThickness * 0.5); + + G4Material* Material + = MaterialManager::getInstance()->GetMaterialFromLibrary( + CatcherMaterial); + m_BeamCatcher + = new G4LogicalVolume(box, Material, "logic_Vamos_Catcher", 0, 0, 0); + m_BeamCatcher->SetVisAttributes(m_VisCatcher); + m_BeamCatcher->SetSensitiveDetector(m_CalorimeterScorer); + } + return m_BeamCatcher; } +///////////////////////////////////////////////////////////////////// +G4LogicalVolume* Vamos::BuildTMW1() { + if (!m_TMW1) { + G4Box* box = new G4Box("Vamos_TMW1", TMW1_Width * 0.5, + TMW1_Length * 0.5, TMW1_Thickness * 0.5); + + G4Material* DetectorMaterial + = MaterialManager::getInstance()->GetGasFromLibrary( + m_Gas_TMW1, m_Pressure_TMW1, 295 * kelvin); + m_TMW1 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_TMW1", + 0, 0, 0); + m_TMW1->SetVisAttributes(m_VisGasC4H10); + + m_TMW1->SetSensitiveDetector(m_TMW1Scorer); + } + return m_TMW1; + +} + +///////////////////////////////////////////////////////////////////// +G4LogicalVolume* Vamos::BuildTMW2() { + if (!m_TMW2) { + G4Box* box = new G4Box("Vamos_TMW2", TMW2_Width * 0.5, + TMW2_Length * 0.5, TMW2_Thickness * 0.5); + + G4Material* DetectorMaterial + = MaterialManager::getInstance()->GetGasFromLibrary( + m_Gas_TMW2, m_Pressure_TMW2, 295 * kelvin); + m_TMW2 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_TMW2", + 0, 0, 0); + m_TMW2->SetVisAttributes(m_VisGasC4H10); + } + return m_TMW2; + +} + + +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildMWPPAC() { - if (!m_MWPPAC) { - G4Box* box = new G4Box("Vamos_MWPPAC", ChamberWidth * 0.5, - ChamberLength * 0.5, ChamberThickness * 0.5); - - G4Material* DetectorMaterial - = MaterialManager::getInstance()->GetGasFromLibrary( - m_Gas[2], m_Pressure[2], m_Temperature[2]); - m_MWPPAC = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_MWPPAC", - 0, 0, 0); - m_MWPPAC->SetVisAttributes(m_VisGasC4H10); - } - return m_MWPPAC; + if (!m_MWPPAC) { + G4Box* box = new G4Box("Vamos_MWPPAC", ChamberWidth * 0.5, + ChamberLength * 0.5, ChamberThickness * 0.5); + + G4Material* DetectorMaterial + = MaterialManager::getInstance()->GetGasFromLibrary( + m_Gas[0], m_Pressure[0], m_Temperature[0]); + m_MWPPAC = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_MWPPAC", + 0, 0, 0); + m_MWPPAC->SetVisAttributes(m_VisGasC4H10); + } + return m_MWPPAC; } +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildDC3() { - if (!m_DC3) { - G4Box* box = new G4Box("Vamos_DC3", ChamberWidth * 0.5, ChamberLength * 0.5, - ChamberThickness * 0.5); - - G4Material* DetectorMaterial - = MaterialManager::getInstance()->GetGasFromLibrary( - m_Gas[3], m_Pressure[3], m_Temperature[3]); - - m_DC3 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC3", 0, 0, - 0); - m_DC3->SetVisAttributes(m_VisGasC4H10); - m_DC3->SetSensitiveDetector(m_DCScorer); - } - return m_DC3; + if (!m_DC3) { + G4Box* box = new G4Box("Vamos_DC3", ChamberWidth * 0.5, ChamberLength * 0.5, + ChamberThickness * 0.5); + + G4Material* DetectorMaterial + = MaterialManager::getInstance()->GetGasFromLibrary( + m_Gas[3], m_Pressure[3], m_Temperature[3]); + + m_DC3 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC3", 0, 0, + 0); + m_DC3->SetVisAttributes(m_VisGasC4H10); + m_DC3->SetSensitiveDetector(m_DCScorer); + } + return m_DC3; } +///////////////////////////////////////////////////////////////////// G4LogicalVolume* Vamos::BuildDC4() { - if (!m_DC4) { - G4Box* box = new G4Box("Vamos_DC4", ChamberWidth * 0.5, ChamberLength * 0.5, - ChamberThickness * 0.5); - - G4Material* DetectorMaterial - = MaterialManager::getInstance()->GetGasFromLibrary( - m_Gas[4], m_Pressure[4], m_Temperature[4]); - - m_DC4 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC4", 0, 0, - 0); - m_DC4->SetVisAttributes(m_VisGasC4H10); - m_DC4->SetSensitiveDetector(m_DCScorer); - } - return m_DC4; + if (!m_DC4) { + G4Box* box = new G4Box("Vamos_DC4", ChamberWidth * 0.5, ChamberLength * 0.5, + ChamberThickness * 0.5); + + G4Material* DetectorMaterial + = MaterialManager::getInstance()->GetGasFromLibrary( + m_Gas[4], m_Pressure[4], m_Temperature[4]); + + m_DC4 = new G4LogicalVolume(box, DetectorMaterial, "logic_Vamos_DC4", 0, 0, + 0); + m_DC4->SetVisAttributes(m_VisGasC4H10); + m_DC4->SetSensitiveDetector(m_DCScorer); + } + return m_DC4; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... // In anticipation of use a macro void Vamos::ClearGeometry(){ - m_Z.clear(); - m_Gas.clear(); - m_Pressure.clear(); - m_Temperature.clear(); + m_Z.clear(); + m_Gas.clear(); + m_Pressure.clear(); + m_Temperature.clear(); - m_ZIC.clear(); - m_ThicknessIC.clear(); - m_PressureIC.clear(); - m_TemperatureIC.clear(); - m_GasIC.clear(); + m_ZIC.clear(); + m_ThicknessIC.clear(); + m_PressureIC.clear(); + m_TemperatureIC.clear(); + m_GasIC.clear(); } @@ -338,202 +401,237 @@ void Vamos::ClearGeometry(){ // Read stream at Configfile to pick-up parameters of detector (Position,...) // Called in DetecorConstruction::ReadDetectorConfiguration Method +///////////////////////////////////////////////////////////////////// void Vamos::ReadConfiguration(NPL::InputParser parser) { - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Vamos"); - if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> TokenBeamCatcher - = {"Material", "Width", "Length", "Thickness", "Pos"}; - vector<string> sphe = {"R", "Theta"}; - vector<string> TokenMWPPAC = {"Z", "Gas", "Pressure", "Temperature"}; - vector<string> TokenDC = {"Z", "Gas", "Pressure", "Temperature"}; - vector<string> TokenIC = {"Z", "Thickness", "Gas", "Pressure", "Temperature"}; - - for (unsigned int i = 0; i < blocks.size(); i++) { - if (blocks[i]->HasTokenList(sphe)) { - if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Vamos " << i + 1 << endl; - G4double R = blocks[i]->GetDouble("R", "mm"); - G4double Theta = blocks[i]->GetDouble("Theta", "deg"); - AddVamos(R, Theta); - } - - else if (blocks[i]->GetMainValue() == "BeamCatcher" - && blocks[i]->HasTokenList(TokenBeamCatcher)) { - if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// BeamCatcher" << i + 1 << endl; - string Material = blocks[i]->GetString("Material"); - G4double Width = blocks[i]->GetDouble("Width", "mm"); - G4double Length = blocks[i]->GetDouble("Length", "mm"); - G4double Thickness = blocks[i]->GetDouble("Thickness", "mm"); - G4ThreeVector Pos - = NPS::ConvertVector(blocks[i]->GetTVector3("Pos", "mm")); - AddBeamCatcher(Material, Width, Length, Thickness, Pos); - } - - else if (blocks[i]->GetMainValue() == "MWPPAC" - && blocks[i]->HasTokenList(TokenMWPPAC)) { - if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// MWPPAC" << i + 1 << endl; - G4double Z = blocks[i]->GetDouble("Z", "mm"); - string Gas = blocks[i]->GetString("Gas"); - G4double Pressure = blocks[i]->GetDouble("Pressure", "bar"); - G4double Temperature = blocks[i]->GetDouble("Temperature", "kelvin"); - AddDetector(Z, Gas, Pressure, Temperature); - } - - else if (blocks[i]->GetMainValue() == "DC" - && blocks[i]->HasTokenList(TokenDC)) { - if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// DC" << i + 1 << endl; - G4double Z = blocks[i]->GetDouble("Z", "mm"); - string Gas = blocks[i]->GetString("Gas"); - G4double Pressure = blocks[i]->GetDouble("Pressure", "bar"); - G4double Temperature = blocks[i]->GetDouble("Temperature", "kelvin"); - AddDetector(Z, Gas, Pressure, Temperature); - } - - else if (blocks[i]->GetMainValue() == "IC" - && blocks[i]->HasTokenList(TokenIC)) { - if (NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// IC" << ICcounter+1 << endl; - G4double Z = blocks[i]->GetDouble("Z", "mm"); - G4double Thickness = blocks[i]->GetDouble("Thickness", "mm"); - string Gas = blocks[i]->GetString("Gas"); - G4double Pressure = blocks[i]->GetDouble("Pressure", "bar"); - G4double Temperature = blocks[i]->GetDouble("Temperature", "kelvin"); - AddIC(Z, Thickness, Gas, Pressure, Temperature); - ICcounter++; - } - - else { - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } + vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Vamos"); + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << "//// " << blocks.size() << " detectors found " << endl; + + vector<string> TokenBeamCatcher + = {"Material", "Width", "Length", "Thickness", "Pos"}; + vector<string> sphe = {"R", "Theta"}; + vector<string> TokenMWPPAC = {"Z", "Gas", "Pressure", "Temperature"}; + vector<string> TokenTMW = {"Z", "Gas", "Pressure"}; + vector<string> TokenDC = {"Z", "Gas", "Pressure", "Temperature"}; + vector<string> TokenIC = {"Z", "Thickness", "Gas", "Pressure", "Temperature"}; + + for (unsigned int i = 0; i < blocks.size(); i++) { + if (blocks[i]->HasTokenList(sphe)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// Vamos " << i + 1 << endl; + G4double R = blocks[i]->GetDouble("R", "mm"); + G4double Theta = blocks[i]->GetDouble("Theta", "deg"); + AddVamos(R, Theta); + } + else if (blocks[i]->GetMainValue() == "BeamCatcher" + && blocks[i]->HasTokenList(TokenBeamCatcher)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// BeamCatcher" << i + 1 << endl; + string Material = blocks[i]->GetString("Material"); + G4double Width = blocks[i]->GetDouble("Width", "mm"); + G4double Length = blocks[i]->GetDouble("Length", "mm"); + G4double Thickness = blocks[i]->GetDouble("Thickness", "mm"); + G4ThreeVector Pos + = NPS::ConvertVector(blocks[i]->GetTVector3("Pos", "mm")); + AddBeamCatcher(Material, Width, Length, Thickness, Pos); } -} -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Vamos::ConstructDetector(G4LogicalVolume* world) { + else if (blocks[i]->GetMainValue() == "MWPPAC" + && blocks[i]->HasTokenList(TokenMWPPAC)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// MWPPAC" << i + 1 << endl; + G4double Z = blocks[i]->GetDouble("Z", "mm"); + string Gas = blocks[i]->GetString("Gas"); + G4double Pressure = blocks[i]->GetDouble("Pressure", "bar"); + G4double Temperature = blocks[i]->GetDouble("Temperature", "kelvin"); + AddDetector(Z, Gas, Pressure, Temperature); + } - // Mother Volume of Vamos - G4double R = m_R + VamosVolumeThickness * 0.5; + else if (blocks[i]->GetMainValue() == "TMW1" + && blocks[i]->HasTokenList(TokenTMW)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// TMW1" << endl; + m_Z_TMW1 = blocks[i]->GetDouble("Z", "mm"); + m_Gas_TMW1 = blocks[i]->GetString("Gas"); + m_Pressure_TMW1 = blocks[i]->GetDouble("Pressure", "bar"); + //AddDetector(Z, Gas, Pressure, Temperature); + } - G4double X = R * sin(m_Theta) * cos(Phi); - G4double Y = R * sin(m_Theta) * sin(Phi); - G4double Z = R * cos(m_Theta); - G4ThreeVector Det_pos = G4ThreeVector(X, Y, Z); + else if (blocks[i]->GetMainValue() == "TMW2" + && blocks[i]->HasTokenList(TokenTMW)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// TMW2" << endl; + m_Z_TMW2 = blocks[i]->GetDouble("Z", "mm"); + m_Gas_TMW2 = blocks[i]->GetString("Gas"); + m_Pressure_TMW2 = blocks[i]->GetDouble("Pressure", "bar"); + //AddDetector(Z, Gas, Pressure, Temperature); + } - G4RotationMatrix* Rot1 = new G4RotationMatrix(); - Rot1->rotateY(m_Theta); - G4Box* MotherSolid - = new G4Box("MotherVolume", VamosVolumeWidth * 0.5, - VamosVolumeLength * 0.5, VamosVolumeThickness * 0.5); - G4Material* VolumeMaterial - = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); - G4LogicalVolume* MotherVolume = new G4LogicalVolume( - MotherSolid, VolumeMaterial, "MotherVolume", 0, 0, 0); + else if (blocks[i]->GetMainValue() == "DC" + && blocks[i]->HasTokenList(TokenDC)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// DC" << i + 1 << endl; + G4double Z = blocks[i]->GetDouble("Z", "mm"); + string Gas = blocks[i]->GetString("Gas"); + G4double Pressure = blocks[i]->GetDouble("Pressure", "bar"); + G4double Temperature = blocks[i]->GetDouble("Temperature", "kelvin"); + AddDetector(Z, Gas, Pressure, Temperature); + } - new G4PVPlacement(G4Transform3D(*Rot1, Det_pos), MotherVolume, "MotherVolume", - world, false, 0); - MotherVolume->SetVisAttributes(m_VisVolumeVamos); + else if (blocks[i]->GetMainValue() == "IC" + && blocks[i]->HasTokenList(TokenIC)) { + if (NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// IC" << ICcounter+1 << endl; + G4double Z = blocks[i]->GetDouble("Z", "mm"); + G4double Thickness = blocks[i]->GetDouble("Thickness", "mm"); + string Gas = blocks[i]->GetString("Gas"); + G4double Pressure = blocks[i]->GetDouble("Pressure", "bar"); + G4double Temperature = blocks[i]->GetDouble("Temperature", "kelvin"); + AddIC(Z, Thickness, Gas, Pressure, Temperature); + ICcounter++; + } - // SubVolume of Detection at the end of Vamos - // The position of the subvolume is defined by the position of the BeamCatcher - G4double R2 - = R_Catcher - CatcherThickness * 0.5 + DetectionVolumeThickness * 0.5; + else { + cout << "ERROR: check your input file formatting " << endl; + exit(1); + } - G4double X2 = R2 * sin(Det_Theta) * cos(0); - G4double Z2 = R2 * cos(Det_Theta); - G4ThreeVector Det_pos2 = G4ThreeVector(X2, 0, Z2); + } +} - G4RotationMatrix* Rot2 = new G4RotationMatrix(); - Rot2->rotateY(Det_Theta); +// Construct detector and inialise sensitive part. +// Called After DetecorConstruction::AddDetector Method +void Vamos::ConstructDetector(G4LogicalVolume* world) { - G4Box* MotherDetectorSolid - = new G4Box("MotherDetector", DetectionVolumeWidth * 0.5, - DetectionVolumeLength * 0.5, DetectionVolumeThickness * 0.5); + // Mother Volume of Vamos + G4double R = m_R + VamosVolumeThickness * 0.5; - G4LogicalVolume* MotherDetector = new G4LogicalVolume( - MotherDetectorSolid, VolumeMaterial, "MotherDetector", 0, 0, 0); + G4double X = R * sin(m_Theta) * cos(Phi); + G4double Y = R * sin(m_Theta) * sin(Phi); + G4double Z = R * cos(m_Theta); + G4ThreeVector Det_pos = G4ThreeVector(X, Y, Z); - new G4PVPlacement(G4Transform3D(*Rot2, Det_pos2), MotherDetector, - "MotherDetector", MotherVolume, false, 0); - MotherDetector->SetVisAttributes(m_VisVolumeVamos); + G4RotationMatrix* Rot1 = new G4RotationMatrix(); + Rot1->rotateY(m_Theta); + G4Box* MotherSolid + = new G4Box("MotherVolume", VamosVolumeWidth * 0.5, + VamosVolumeLength * 0.5, VamosVolumeThickness * 0.5); - // Position the entry DCs and the magnets in the MotherVolume - new G4PVPlacement(0, G4ThreeVector(0, 0, -VamosVolumeThickness * 0.5 + m_Z[0]), - BuildDC1(), "Entrance_DC1", MotherVolume, false, 1); + G4Material* VolumeMaterial + = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum"); + G4LogicalVolume* MotherVolume = new G4LogicalVolume( + MotherSolid, VolumeMaterial, "MotherVolume", 0, 0, 0); - new G4PVPlacement(0, G4ThreeVector(0, 0, -VamosVolumeThickness * 0.5 + m_Z[1]), - BuildDC2(), "Entrance_DC2", MotherVolume, false, 2); + new G4PVPlacement(G4Transform3D(*Rot1, Det_pos), MotherVolume, "MotherVolume", + world, false, 0); + MotherVolume->SetVisAttributes(m_VisVolumeVamos); - new G4PVPlacement( - 0, - G4ThreeVector(0, 0, (-VamosVolumeThickness + MagnetThickness) * 0.5 + 400), - BuildQuad1(), "Vamos", MotherVolume, false, 0); + // SubVolume of Detection at the end of Vamos + // The position of the subvolume is defined by the position of the BeamCatcher + G4double R2 + = R_Catcher - CatcherThickness * 0.5 + DetectionVolumeThickness * 0.5; - new G4PVPlacement( - 0, - G4ThreeVector(0, 0, - (-VamosVolumeThickness + MagnetThickness) * 0.5 + 700 * mm), - BuildQuad2(), "Vamos", MotherVolume, false, 0); + G4double X2 = R2 * sin(Det_Theta) * cos(0); + G4double Z2 = R2 * cos(Det_Theta); + G4ThreeVector Det_pos2 = G4ThreeVector(X2, 0, Z2); - new G4PVPlacement( - 0, - G4ThreeVector(0, 0, - (-VamosVolumeThickness + MagnetThickness) * 0.5 + 1500 * mm), - BuildDipol(), "Vamos", MotherVolume, false, 0); + G4RotationMatrix* Rot2 = new G4RotationMatrix(); + Rot2->rotateY(Det_Theta); - // Position the system of detection at the end of Vamos in the sub Volume - new G4PVPlacement(0, m_PosCatcher, BuildBeamCatcher(), "BeamCatcher", - MotherDetector, false, 3); + G4Box* MotherDetectorSolid + = new G4Box("MotherDetector", DetectionVolumeWidth * 0.5, + DetectionVolumeLength * 0.5, DetectionVolumeThickness * 0.5); - new G4PVPlacement( - 0, - G4ThreeVector(0, 0, - -DetectionVolumeThickness * 0.5 - + (m_Z[2] - R_Catcher + CatcherThickness * 0.5)), - BuildMWPPAC(), "MWPPAC", MotherDetector, false, 4); + G4LogicalVolume* MotherDetector = new G4LogicalVolume( + MotherDetectorSolid, VolumeMaterial, "MotherDetector", 0, 0, 0); - new G4PVPlacement( - 0, - G4ThreeVector(0, 0, - -DetectionVolumeThickness * 0.5 - + (m_Z[3] - R_Catcher + CatcherThickness * 0.5)), - BuildDC3(), "DC", MotherDetector, false, 5); + new G4PVPlacement(G4Transform3D(*Rot2, Det_pos2), MotherDetector, + "MotherDetector", MotherVolume, false, 0); + MotherDetector->SetVisAttributes(m_VisVolumeVamos); + + + // Position the entry DCs and the magnets in the MotherVolume + /*new G4PVPlacement(0, G4ThreeVector(0, 0, -VamosVolumeThickness * 0.5 + m_Z[0]), + BuildDC1(), "Entrance_DC1", MotherVolume, false, 1); + + new G4PVPlacement(0, G4ThreeVector(0, 0, -VamosVolumeThickness * 0.5 + m_Z[1]), + BuildDC2(), "Entrance_DC2", MotherVolume, false, 2);*/ + + new G4PVPlacement( + 0, + G4ThreeVector(0, 0, (-VamosVolumeThickness + MagnetThickness) * 0.5 + 400), + BuildQuad1(), "Vamos", MotherVolume, false, 0); + + new G4PVPlacement( + 0, + G4ThreeVector(0, 0, + (-VamosVolumeThickness + MagnetThickness) * 0.5 + 700 * mm), + BuildQuad2(), "Vamos", MotherVolume, false, 0); + + new G4PVPlacement( + 0, + G4ThreeVector(0, 0, + (-VamosVolumeThickness + MagnetThickness) * 0.5 + 1500 * mm), + BuildDipol(), "Vamos", MotherVolume, false, 0); + + // Position the system of detection at the end of Vamos in the sub Volume + /*new G4PVPlacement(0, m_PosCatcher, BuildBeamCatcher(), "BeamCatcher", + MotherDetector, false, 3);*/ + + new G4PVPlacement( + 0, + G4ThreeVector(0, 0, -VamosVolumeThickness * 0.5 + TMW1_Thickness * 0.5), + BuildTMW1(), "TMW1", MotherVolume, false, 0); + + new G4PVPlacement( + 0, + G4ThreeVector(0, 0, -VamosVolumeThickness * 0.5 + TMW2_Thickness * 0.5 + m_Z_TMW2), + BuildTMW2(), "TMW2", MotherVolume, false, 0); + + +/* new G4PVPlacement( + 0, + G4ThreeVector(0, 0, + -DetectionVolumeThickness * 0.5 + + (m_Z[0] - R_Catcher + CatcherThickness * 0.5)), + BuildMWPPAC(), "MWPPAC", MotherDetector, false, 1); +*/ + /* new G4PVPlacement( + 0, + G4ThreeVector(0, 0, + -DetectionVolumeThickness * 0.5 + + (m_Z[3] - R_Catcher + CatcherThickness * 0.5)), + BuildDC3(), "DC", MotherDetector, false, 5); - new G4PVPlacement( - 0, - G4ThreeVector(0, 0, - -DetectionVolumeThickness * 0.5 - + (m_Z[4] - R_Catcher + CatcherThickness * 0.5)), - BuildDC4(), "DC", MotherDetector, false, 6); - - // Construct and position the Ionisations Chambers - for (int i = 0; i < ICcounter; i++) { - G4Box* box = new G4Box("Vamos_IC", ChamberWidth * 0.5, ChamberLength * 0.5, - m_ThicknessIC[i] * 0.5); - G4Material* GasIC = MaterialManager::getInstance()->GetGasFromLibrary( - m_GasIC[i], m_PressureIC[i], m_TemperatureIC[i]); - G4LogicalVolume* IC - = new G4LogicalVolume(box, GasIC, "logic_Vamos_IC", 0, 0, 0); - IC->SetVisAttributes(m_VisGasCF4); - IC->SetSensitiveDetector(m_CalorimeterScorer); new G4PVPlacement( - 0, - G4ThreeVector(0, 0, - -DetectionVolumeThickness * 0.5 - + (m_ZIC[i] - R_Catcher + CatcherThickness * 0.5)), - IC, "IC", MotherDetector, false, i + 7); - } + 0, + G4ThreeVector(0, 0, + -DetectionVolumeThickness * 0.5 + + (m_Z[4] - R_Catcher + CatcherThickness * 0.5)), + BuildDC4(), "DC", MotherDetector, false, 6);*/ + + // Construct and position the Ionisations Chambers + /*for (int i = 0; i < ICcounter; i++) { + G4Box* box = new G4Box("Vamos_IC", ChamberWidth * 0.5, ChamberLength * 0.5, + m_ThicknessIC[i] * 0.5); + G4Material* GasIC = MaterialManager::getInstance()->GetGasFromLibrary( + m_GasIC[i], m_PressureIC[i], m_TemperatureIC[i]); + G4LogicalVolume* IC + = new G4LogicalVolume(box, GasIC, "logic_Vamos_IC", 0, 0, 0); + IC->SetVisAttributes(m_VisGasCF4); + IC->SetSensitiveDetector(m_CalorimeterScorer); + new G4PVPlacement( + 0, + G4ThreeVector(0, 0, + -DetectionVolumeThickness * 0.5 + + (m_ZIC[i] - R_Catcher + CatcherThickness * 0.5)), + IC, "IC", MotherDetector, false, i + 7); + }*/ } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -541,12 +639,12 @@ void Vamos::ConstructDetector(G4LogicalVolume* world) { // Called After DetecorConstruction::AddDetector Method void Vamos::InitializeRootOutput() { - RootOutput* pAnalysis = RootOutput::getInstance(); - TTree* pTree = pAnalysis->GetTree(); - if (!pTree->FindBranch("Vamos")) { - pTree->Branch("Vamos", "TVamosData", &m_Event); - } - pTree->SetBranchAddress("Vamos", &m_Event); + RootOutput* pAnalysis = RootOutput::getInstance(); + TTree* pTree = pAnalysis->GetTree(); + if (!pTree->FindBranch("Vamos")) { + pTree->Branch("Vamos", "TVamosData", &m_Event); + } + pTree->SetBranchAddress("Vamos", &m_Event); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -554,67 +652,71 @@ void Vamos::InitializeRootOutput() { // Called at in the EventAction::EndOfEventAvtion void Vamos::ReadSensitive(const G4Event*) { - m_Event->Clear(); - - /////////// - // Calorimeter scorer - CalorimeterScorers::PS_Calorimeter* Scorer - = (CalorimeterScorers::PS_Calorimeter*)m_CalorimeterScorer->GetPrimitive( - 0); - unsigned int size = Scorer->GetMult(); - for (unsigned int i = 0; i < size; i++) { - vector<unsigned int> level = Scorer->GetLevel(i); - G4double Energy - = RandGauss::shoot(Scorer->GetEnergy(i), Vamos_NS::ResoEnergy); - if (Energy > Vamos_NS::EnergyThreshold) { - G4double Time = RandGauss::shoot(Scorer->GetTime(i), Vamos_NS::ResoTime); - int DetectorNbr = level[0]; - m_Event->SetEnergy(DetectorNbr, Energy); - m_Event->SetTime(DetectorNbr, Time); - } - } - /////////// - // DriftChamber scorer - DriftChamberScorers::PS_DriftChamber* Scorer2 - = (DriftChamberScorers::PS_DriftChamber*)m_DCScorer->GetPrimitive(0); - unsigned int size2 = Scorer2->GetMult(); - for (unsigned int i = 0; i < size2; i++) { - vector<unsigned int> level = Scorer2->GetLevel(i); - G4double DriftTime - = RandGauss::shoot(Scorer2->GetDriftTime(i)/Scorer2->GetCounter(i), Vamos_NS::ResoDriftTime); - G4double X - = RandGauss::shoot(Scorer2->GetX(i)/Scorer2->GetCounter(i), ResoPosX); - int DetectorNbr = level[0]; - m_Event->SetDrift(DetectorNbr, DriftTime, X); + m_Event->Clear(); + + /////////// + // Calorimeter scorer + CalorimeterScorers::PS_Calorimeter* Scorer + = (CalorimeterScorers::PS_Calorimeter*)m_CalorimeterScorer->GetPrimitive(0); + unsigned int size = Scorer->GetMult(); + for (unsigned int i = 0; i < size; i++) { + vector<unsigned int> level = Scorer->GetLevel(i); + G4double Energy + = RandGauss::shoot(Scorer->GetEnergy(i), Vamos_NS::ResoEnergy); + if (Energy > Vamos_NS::EnergyThreshold) { + G4double Time = RandGauss::shoot(Scorer->GetTime(i), Vamos_NS::ResoTime); + int DetectorNbr = level[0]; + m_Event->SetEnergy(DetectorNbr, Energy); + m_Event->SetTime(DetectorNbr, Time); } + } + /////////// + // DriftChamber scorer + DriftChamberScorers::PS_DriftChamber* Scorer2 + = (DriftChamberScorers::PS_DriftChamber*)m_DCScorer->GetPrimitive(0); + unsigned int size2 = Scorer2->GetMult(); + for (unsigned int i = 0; i < size2; i++) { + vector<unsigned int> level = Scorer2->GetLevel(i); + G4double DriftTime + = RandGauss::shoot(Scorer2->GetDriftTime(i)/Scorer2->GetCounter(i), Vamos_NS::ResoDriftTime); + G4double X + = RandGauss::shoot(Scorer2->GetX(i)/Scorer2->GetCounter(i), ResoPosX); + int DetectorNbr = level[0]; + m_Event->SetDrift(DetectorNbr, DriftTime, X); + } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //////////////////////////////////////////////////////////////// void Vamos::InitializeScorers() { - // This check is necessary in case the geometry is reloaded - bool already_exist = false; - m_DCScorer = CheckScorer("DCScorer", already_exist); - m_CalorimeterScorer = CheckScorer("VamosScorer", already_exist); - if (already_exist) - return; - - // Otherwise the scorer is initialised - vector<int> level; - level.push_back(0); - - G4VPrimitiveScorer* Calorimeter - = new CalorimeterScorers::PS_Calorimeter("Calorimeter", level, 0); - m_CalorimeterScorer->RegisterPrimitive(Calorimeter); - - G4VPrimitiveScorer* Drift = new DriftChamberScorers::PS_DriftChamber( - "Drift", level, DriftDir, DriftSpeed, 0); - m_DCScorer->RegisterPrimitive(Drift); - - // and register it to the multifunctionnal detector - G4SDManager::GetSDMpointer()->AddNewDetector(m_DCScorer); - G4SDManager::GetSDMpointer()->AddNewDetector(m_CalorimeterScorer); + // This check is necessary in case the geometry is reloaded + bool already_exist = false; + m_DCScorer = CheckScorer("DCScorer", already_exist); + m_CalorimeterScorer = CheckScorer("VamosScorer", already_exist); + m_TMW1Scorer = CheckScorer("TMW1Scorer", already_exist); + if (already_exist) + return; + + // Otherwise the scorer is initialised + vector<int> level; + level.push_back(0); + + G4VPrimitiveScorer* Calorimeter + = new CalorimeterScorers::PS_Calorimeter("Calorimeter", level, 0); + m_CalorimeterScorer->RegisterPrimitive(Calorimeter); + + G4VPrimitiveScorer* Drift = new DriftChamberScorers::PS_DriftChamber( + "Drift", level, DriftDir, DriftSpeed, 0); + m_DCScorer->RegisterPrimitive(Drift); + + G4VPrimitiveScorer* InteractionTMW1 = new InteractionScorers::PS_Interactions("InteractionTMW1",ms_InterCoord,0); + m_TMW1Scorer->RegisterPrimitive(InteractionTMW1); + + // and register it to the multifunctionnal detector + G4SDManager::GetSDMpointer()->AddNewDetector(m_DCScorer); + G4SDManager::GetSDMpointer()->AddNewDetector(m_CalorimeterScorer); + G4SDManager::GetSDMpointer()->AddNewDetector(m_TMW1Scorer); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -628,13 +730,13 @@ NPS::VDetector* Vamos::Construct() { return (NPS::VDetector*)new Vamos(); } // Registering the construct method to the factory // //////////////////////////////////////////////////////////////////////////////// extern "C" { - class proxy_nps_Vamos { - public: - proxy_nps_Vamos() { - NPS::DetectorFactory::getInstance()->AddToken("Vamos", "Vamos"); - NPS::DetectorFactory::getInstance()->AddDetector("Vamos", Vamos::Construct); - } - }; - - proxy_nps_Vamos p_nps_Vamos; + class proxy_nps_Vamos { + public: + proxy_nps_Vamos() { + NPS::DetectorFactory::getInstance()->AddToken("Vamos", "Vamos"); + NPS::DetectorFactory::getInstance()->AddDetector("Vamos", Vamos::Construct); + } + }; + + proxy_nps_Vamos p_nps_Vamos; } diff --git a/NPSimulation/Detectors/Vamos/Vamos.hh b/NPSimulation/Detectors/Vamos/Vamos.hh index d4e6b3dc0372b2e92ccef1261623cb02a75cc9fc..b33f39dfc66fd70a185331d33590d4620deb546e 100644 --- a/NPSimulation/Detectors/Vamos/Vamos.hh +++ b/NPSimulation/Detectors/Vamos/Vamos.hh @@ -39,134 +39,147 @@ using namespace std; #include "NPInputParser.h" class Vamos : public NPS::VDetector{ + //////////////////////////////////////////////////// + /////// Default Constructor and Destructor ///////// + //////////////////////////////////////////////////// + public: + Vamos() ; + virtual ~Vamos() ; + + //////////////////////////////////////////////////// + /////// Specific Function of this Class /////////// + //////////////////////////////////////////////////// + public: + + void AddVamos(G4double R,double Theta); + void AddBeamCatcher(string Material, G4double Width, double Length, double Thickness, G4ThreeVector Pos); + void AddDetector(G4double Z, string Gas, double Pressure, double Temperature); + void AddIC(G4double Z, double Thickness, string Gas, double Pressure, double Temperature); + + G4LogicalVolume* BuildDC1(); + G4LogicalVolume* BuildDC2(); + + G4LogicalVolume* BuildQuad1(); + G4LogicalVolume* BuildQuad2(); + G4LogicalVolume* BuildDipol(); + + G4LogicalVolume* BuildBeamCatcher(); + G4LogicalVolume* BuildMWPPAC(); + G4LogicalVolume* BuildDC3(); + G4LogicalVolume* BuildDC4(); + G4LogicalVolume* BuildIC(); + G4LogicalVolume* BuildTMW1(); + G4LogicalVolume* BuildTMW2(); + + private: + + G4LogicalVolume* m_DC1; + G4LogicalVolume* m_DC2; + + G4LogicalVolume* m_Quad1; + G4LogicalVolume* m_Quad2; + G4LogicalVolume* m_Dipol; + + G4LogicalVolume* m_BeamCatcher; + G4LogicalVolume* m_MWPPAC; + G4LogicalVolume* m_DC3; + G4LogicalVolume* m_DC4; + G4LogicalVolume* m_IC; + G4LogicalVolume* m_TMW1; + G4LogicalVolume* m_TMW2; + + G4double ICcounter; + //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// + ////// Inherite from NPS::VDetector class ///////// //////////////////////////////////////////////////// - public: - Vamos() ; - virtual ~Vamos() ; + public: + // Read stream at Configfile to pick-up parameters of detector (Position,...) + + void ClearGeometry(); + + // Called in DetecorConstruction::ReadDetextorConfiguration Method + void ReadConfiguration(NPL::InputParser) ; - //////////////////////////////////////////////////// - /////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// - public: + // Construct detector and inialise sensitive part. + // Called After DetecorConstruction::AddDetector Method + void ConstructDetector(G4LogicalVolume* world) ; - void AddVamos(G4double R,double Theta); - void AddBeamCatcher(string Material, G4double Width, double Length, double Thickness, G4ThreeVector Pos); - void AddDetector(G4double Z, string Gas, double Pressure, double Temperature); - void AddIC(G4double Z, double Thickness, string Gas, double Pressure, double Temperature); + // Add Detector branch to the EventTree. + // Called After DetecorConstruction::AddDetector Method + void InitializeRootOutput() ; - G4LogicalVolume* BuildDC1(); - G4LogicalVolume* BuildDC2(); + // Read sensitive part and fill the Root tree. + // Called at in the EventAction::EndOfEventAvtion + void ReadSensitive(const G4Event* event) ; - G4LogicalVolume* BuildQuad1(); - G4LogicalVolume* BuildQuad2(); - G4LogicalVolume* BuildDipol(); - - G4LogicalVolume* BuildBeamCatcher(); - G4LogicalVolume* BuildMWPPAC(); - G4LogicalVolume* BuildDC3(); - G4LogicalVolume* BuildDC4(); - G4LogicalVolume* BuildIC(); - - private: - - G4LogicalVolume* m_DC1; - G4LogicalVolume* m_DC2; - - G4LogicalVolume* m_Quad1; - G4LogicalVolume* m_Quad2; - G4LogicalVolume* m_Dipol; - - G4LogicalVolume* m_BeamCatcher; - G4LogicalVolume* m_MWPPAC; - G4LogicalVolume* m_DC3; - G4LogicalVolume* m_DC4; - G4LogicalVolume* m_IC; - - G4double ICcounter; - - //////////////////////////////////////////////////// - ////// Inherite from NPS::VDetector class ///////// - //////////////////////////////////////////////////// - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - - void ClearGeometry(); - - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser) ; - - // Construct detector and inialise sensitive part. - // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; - - // Add Detector branch to the EventTree. - // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; - - // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; - - public: - // Scorer - // Initialize all Scorer used by Vamos - void InitializeScorers() ; - - // Associated Scorer - G4MultiFunctionalDetector* m_CalorimeterScorer ; - G4MultiFunctionalDetector* m_DCScorer ; - - //////////////////////////////////////////////////// - ///////////Event class to store Data//////////////// - //////////////////////////////////////////////////// - - private: - TVamosData* m_Event ; - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// - - private: - - // Geometry - - G4double R_Catcher = 0; - G4double CatcherWidth = 0; - G4double CatcherLength = 0; - G4double CatcherThickness = 0; - G4double m_R = 0; // distance Target- Entrance of the Mother Volume - G4double m_Theta = 0; - // Detector Coordinate - - string CatcherMaterial; - - G4ThreeVector m_PosCatcher; - vector<G4double> m_Z ; - vector<string> m_Gas; - vector<G4double> m_Pressure; - vector<G4double> m_Temperature; + public: + // Scorer + // Initialize all Scorer used by Vamos + void InitializeScorers() ; - vector<G4double> m_ZIC; - vector<G4double> m_ThicknessIC; - vector<G4double> m_PressureIC; - vector<G4double> m_TemperatureIC; - vector<string> m_GasIC; + // Associated Scorer + G4MultiFunctionalDetector* m_CalorimeterScorer ; + G4MultiFunctionalDetector* m_DCScorer ; + G4MultiFunctionalDetector* m_TMW1Scorer ; - // Shape type + //////////////////////////////////////////////////// + ///////////Event class to store Data//////////////// + //////////////////////////////////////////////////// + + private: + TVamosData* m_Event ; - // Visualisation Attribute - G4VisAttributes* m_VisQuad; - G4VisAttributes* m_VisDC; - G4VisAttributes* m_VisVolumeVamos; - G4VisAttributes* m_VisCatcher; - G4VisAttributes* m_VisGasC4H10; - G4VisAttributes* m_VisGasCF4; + //////////////////////////////////////////////////// + ///////////////Private intern Data////////////////// + //////////////////////////////////////////////////// - public: - static NPS::VDetector* Construct(); + private: + + // Geometry + + G4double R_Catcher = 0; + G4double CatcherWidth = 0; + G4double CatcherLength = 0; + G4double CatcherThickness = 0; + G4double m_R = 0; // distance Target- Entrance of the Mother Volume + G4double m_Theta = 0; + // Detector Coordinate + + string CatcherMaterial; + + G4ThreeVector m_PosCatcher; + vector<G4double> m_Z ; + vector<string> m_Gas; + vector<G4double> m_Pressure; + vector<G4double> m_Temperature; + + vector<G4double> m_ZIC; + vector<G4double> m_ThicknessIC; + vector<G4double> m_PressureIC; + vector<G4double> m_TemperatureIC; + vector<string> m_GasIC; + + // TMW1-2 + double m_Z_TMW1; + double m_Z_TMW2; + string m_Gas_TMW1; + string m_Gas_TMW2; + double m_Pressure_TMW1; + double m_Pressure_TMW2; + + // Shape type + + // Visualisation Attribute + G4VisAttributes* m_VisQuad; + G4VisAttributes* m_VisDC; + G4VisAttributes* m_VisVolumeVamos; + G4VisAttributes* m_VisCatcher; + G4VisAttributes* m_VisGasC4H10; + G4VisAttributes* m_VisGasCF4; + + public: + static NPS::VDetector* Construct(); }; #endif diff --git a/Projects/PISTA/GEF.source b/Projects/PISTA/GEF.source new file mode 100755 index 0000000000000000000000000000000000000000..c11d02e25794b76f88dd29c94ad816bb1dfd0020 --- /dev/null +++ b/Projects/PISTA/GEF.source @@ -0,0 +1,21 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% An Isotropic Source to be used as EventGenerator %%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Energy are given in MeV , Position in mm % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +GEFReader + GEFversion= 2023.33 + InputDataFile= /home/sofia/Physics/Codes/GEF_2024.3.3/out/240Pu_8MeV.lmd + x0= 0 + y0= 0 + z0= 0 mm + TwoBodyReaction= 238U(12C,10Be)240Pu@1428 + FissioningSystem= 240Pu + SigmaX= 0 mm + SigmaY= 0 mm + Particle= fragments +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Supported particle type: proton, neutron, gamma, fragments. +% If you want to see all particles of the file, you may give no argument. +% KineticEnergy_FS gives additional kinetic energy along Z and boosts fragments +% and evaporated particles accordingly. To be refined to various angles. diff --git a/Projects/PISTA/pista.detector b/Projects/PISTA/pista.detector new file mode 100644 index 0000000000000000000000000000000000000000..6429b8458d912747af604fde2c06cd8babafe171 --- /dev/null +++ b/Projects/PISTA/pista.detector @@ -0,0 +1,90 @@ +%%%%%%%%%%%%%%%%%%%% +Target + THICKNESS= 0.44 micrometer + RADIUS= 5 mm + MATERIAL= C + ANGLE= 0 deg + X= 0 mm + Y= 0 mm + Z= 0 mm + +%%%%%%%%%%%%%%%%%%%% +Vamos + R= 162.7 mm + Theta= 20 deg + +Vamos TMW1 + Z = 0 mm + Gas= iC4H10 + Pressure= 0.01 bar + +Vamos TMW2 + Z = 109.3 mm + Gas= iC4H10 + Pressure= 0.01 bar + + + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= 36.71 96.1 50.7 + POS_B= -35.92 95.8 51.3 + POS_C= -19.35 56.5 93.4 + POS_D= 20.8 56.6 93.1 + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= -42.15 93.1 51.1 + POS_B= -93.62 41.8 51.6 + POS_C= -54.12 25.3 93.6 + POS_D= -25.66 53.6 93.4 + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= -95.98 35.6 51.3 + POS_B= -95.63 -37.1 51.5 + POS_C= -56.22 -20.7 93.7 + POS_D= -56.39 19.5 93.6 + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= -93.34 -43.5 50.9 + POS_B= -41.88 -94.8 51.3 + POS_C= -25.41 -55.2 93.2 + POS_D= -53.84 -26.8 93.0 + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= -35.66 -97.1 51.3 + POS_B= 36.98 -96.9 51.1 + POS_C= 20.9 -57.4 93.4 + POS_D= -19.24 -57.6 93.5 + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= 43.66 -94.4 50.9 + POS_B= 95.19 -43.3 50.8 + POS_C= 56.03 -26.6 93.1 + POS_D= 27.54 -54.9 93.2 + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= 96.87 -36.8 50.3 + POS_B= 97.41 35.8 50.4 + POS_C= 57.83 20.0 92.6 + POS_D= 57.52 -20.1 92.6 + +%%%%%%%%%%%%%%%%%%%% +PISTA + VERSION= 1 + POS_A= 94.39 42.0 50.8 + POS_B= 42.94 93.3 50.7 + POS_C= 26.47 54.1 93.0 + POS_D= 54.9 25.7 93.1 diff --git a/Projects/PISTA/project.config b/Projects/PISTA/project.config new file mode 100644 index 0000000000000000000000000000000000000000..c519edf640d2dcbca6b7a9befa756c910634213c --- /dev/null +++ b/Projects/PISTA/project.config @@ -0,0 +1,5 @@ +Project pista + AnalysisOutput= ./root/analysis + SimulationOutput= ./root/simulation + EnergyLoss= ./EnergyLossTable +