diff --git a/NPSimulation/Detectors/Samurai/CMakeLists.txt b/NPSimulation/Detectors/Samurai/CMakeLists.txt index 96e0eaedf049e6bfd4b49a3c52b0e9812b1634cd..c77d1a47210d739baf592595c3fd6c6187abcf33 100644 --- a/NPSimulation/Detectors/Samurai/CMakeLists.txt +++ b/NPSimulation/Detectors/Samurai/CMakeLists.txt @@ -1,2 +1,2 @@ -add_library(NPSSamurai SHARED Samurai.cc SamuraiFieldPropagation.cc SamuraiFDC2.cc) +add_library(NPSSamurai SHARED Samurai.cc SamuraiFieldPropagation.cc SamuraiFDC2.cc SamuraiFDC1.cc) target_link_libraries(NPSSamurai NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPSamurai) diff --git a/NPSimulation/Detectors/Samurai/SamuraiFDC1.cc b/NPSimulation/Detectors/Samurai/SamuraiFDC1.cc new file mode 100644 index 0000000000000000000000000000000000000000..f17fdd83bf58fed7a867c27c4151b6186fd95f05 --- /dev/null +++ b/NPSimulation/Detectors/Samurai/SamuraiFDC1.cc @@ -0,0 +1,266 @@ +/***************************************************************************** + * Copyright (C) 2009-2021 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Omar Nasr contact address: omar.h.nasr@outlook.com * + * * + * Creation Date : septembre 2021 * + * Last update : septembre 2021 * + *---------------------------------------------------------------------------* + * Decription: * + * This class describe Samurai simulation * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ + +// C++ headers +#include <sstream> +#include <cmath> +//G4 Geometry object +#include "G4Box.hh" + +//G4 sensitive +#include "G4SDManager.hh" +#include "G4MultiFunctionalDetector.hh" + +//G4 various object +#include "G4Material.hh" +#include "G4Transform3D.hh" +#include "G4PVPlacement.hh" +#include "G4VisAttributes.hh" +#include "G4Colour.hh" +#include "G4RegionStore.hh" + +// NPTool header +#include "SamuraiFDC1.hh" +//#include "CalorimeterScorers.hh" +#include "InteractionScorers.hh" +#include "RootOutput.h" +#include "MaterialManager.hh" +#include "NPSDetectorFactory.hh" +#include "NPOptionManager.h" +#include "NPSHitsMap.hh" +// CLHEP header +#include "CLHEP/Random/RandGauss.h" + +using namespace std; +using namespace CLHEP; + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +namespace SamuraiFDC1_NS{ + // Samurai magnet construction paramethers + + //Main outer box + const double FDC1_Width = 1000*mm; //(x) + const double FDC1_Height = 696*mm;//(y) + const double FDC1_Depth = 336*mm;//(z) + const string FDC1_Material = "G4_AIR"; + + //Detector Number + const short int FDC1_DetectorNumber = 1; + +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +// Samurai Specific Method +SamuraiFDC1::SamuraiFDC1(){ + + //Visualization attributes + m_VisFDC1 = new G4VisAttributes(G4Colour(1,1,0,0.5)); + //Logical volumes + m_FDC1 = NULL; + //Scorer + m_FDC1Scorer = NULL; + //Ideal Data event + m_Event = new TSamuraiIdealData; + +} + +SamuraiFDC1::~SamuraiFDC1(){ +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void SamuraiFDC1::AddDetector(G4ThreeVector Mag_Pos, G4ThreeVector Offset){ + + m_Pos = Mag_Pos + Offset; + + return; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +G4LogicalVolume* SamuraiFDC1::BuildFDC1(){ + if(!m_FDC1){ + //Shape - G4Box + G4Box* box = new G4Box("FDC1_Box",SamuraiFDC1_NS::FDC1_Width*0.5, + SamuraiFDC1_NS::FDC1_Height*0.5,SamuraiFDC1_NS::FDC1_Depth*0.5); + + //Material - vacuum + G4Material* VacuumMaterial = MaterialManager::getInstance() + ->GetMaterialFromLibrary(SamuraiFDC1_NS::FDC1_Material); + + //Logical Volume + m_FDC1 = new G4LogicalVolume(box, VacuumMaterial, "logic_SamuraiFDC1_box",0,0,0); + m_FDC1->SetVisAttributes(m_VisFDC1); + m_FDC1->SetSensitiveDetector(m_FDC1Scorer); + } + return m_FDC1; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +// Virtual Method of NPS::VDetector class + +// Read stream at Configfile to pick-up parameters of detector (Position,...) +// (Called in DetecorConstruction::ReadDetectorConfiguration Method) +void SamuraiFDC1::ReadConfiguration(NPL::InputParser parser){ + + vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Samurai"); + vector<NPL::InputBlock*> blocks2 = parser.GetAllBlocksWithToken("SAMURAIFDC1"); + + if(blocks.size()==1 && blocks2.size()==1){ + if(NPOptionManager::getInstance()->GetVerboseLevel()) { + cout << "/////// Samurai FDC1 found ///////" << endl; + } + vector<string> cart = {"POS","ANGLE"}; + vector<string> sphe = {"R","Theta","Phi","ANGLE"}; + + G4ThreeVector Mag_Pos; + + if(blocks[0]->HasTokenList(cart)){ + Mag_Pos = NPS::ConvertVector(blocks[0]->GetTVector3("POS", "cm")); + } + else if(blocks[0]->HasTokenList(sphe)){ + double R = blocks[0]->GetDouble("R","mm"); + double Theta = blocks[0]->GetDouble("Theta","deg"); + double Phi = blocks[0]->GetDouble("Phi","deg"); + Mag_Pos.setMag(R); + Mag_Pos.setTheta(Theta); + Mag_Pos.setPhi(Phi); + } + + G4ThreeVector Offset = NPS::ConvertVector(blocks2[0]->GetTVector3("Offset", "mm")); + + //string xml = blocks2[0]->GetString("XML"); + //bool invert_x = blocks2[0]->GetBool("InvertX"); + //bool invert_y = blocks2[0]->GetBool("InvertY"); + //bool invert_z = blocks2[0]->GetBool("InvertD"); + + AddDetector(Mag_Pos, Offset); + + } + else{ + cout << "ERROR: there should be only one Samurai magnet, check your input file" << endl; + exit(1); + } + + +} + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +// Construct detector and inialise sensitive part. +// (Called After DetectorConstruction::AddDetector Method) +void SamuraiFDC1::ConstructDetector(G4LogicalVolume* world){ + + new G4PVPlacement(0, m_Pos, + BuildFDC1(), "SamuraiFDC1", world, false, 0); + + return; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +// Add Detector branch to the EventTree. +// Called After DetecorConstruction::AddDetector Method +void SamuraiFDC1::InitializeRootOutput(){ + RootOutput *pAnalysis = RootOutput::getInstance(); + TTree *pTree = pAnalysis->GetTree(); + if(!pTree->FindBranch("IdealData")){ + pTree->Branch("IdealData", "TSamuraiIdealData", &m_Event) ; + } + pTree->SetBranchAddress("IdealData", &m_Event); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +// Read sensitive part and fill the Root tree. +// (Called at in the EventAction::EndOfEventAvtion) + +void SamuraiFDC1::ReadSensitive(const G4Event* event){ + + m_Event->Clear(); + //Interaction Scorer + InteractionScorers::PS_Interactions* Scorer= (InteractionScorers::PS_Interactions*) m_FDC1Scorer->GetPrimitive(0); + + unsigned int size = Scorer->GetMult(); + for(unsigned int i = 0 ; i < size ; i++){ + //vector<unsigned int> level = Scorer->GetLevel(i); + //double Energy = RandGauss::shoot(Scorer->GetEnergy(i),SamuraiFDC1_NS::ResoEnergy); + //double Energy = Scorer->GetEnergy(i); + + double energy = Scorer->GetEnergy(i); + double brho = Scorer->GetBrho(i); + double posx = Scorer->GetPositionX(i); + double posy = Scorer->GetPositionY(i); + double posz = Scorer->GetPositionZ(i); + double mom_mag = brho*Scorer->GetCharge(i); + double theta = Scorer->GetTheta(i); + double phi = Scorer->GetPhi(i); + m_Event->SetData(SamuraiFDC1_NS::FDC1_DetectorNumber, energy, posx, posy, posz, mom_mag, theta, phi, brho); + } +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void SamuraiFDC1::InitializeScorers() { + // This check is necessary in case the geometry is reloaded + bool already_exist = false; + m_FDC1Scorer = CheckScorer("FDC1Scorer",already_exist) ; + + if(already_exist) + return ; + + // Otherwise the scorer is initialised + vector<int> level; level.push_back(0); + //Interaction + G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; + m_FDC1Scorer->RegisterPrimitive(Interaction); + G4SDManager::GetSDMpointer()->AddNewDetector(m_FDC1Scorer) ; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +//////////////////////////////////////////////////////////////////////////////// +// Construct Method to be pass to the DetectorFactory // +//////////////////////////////////////////////////////////////////////////////// + +NPS::VDetector* SamuraiFDC1::Construct(){ + return (NPS::VDetector*) new SamuraiFDC1(); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +//////////////////////////////////////////////////////////////////////////////// +// Registering the construct method to the factory // +//////////////////////////////////////////////////////////////////////////////// +extern"C" { + class proxy_nps_samuraiFDC1{ + public: + proxy_nps_samuraiFDC1(){ + NPS::DetectorFactory::getInstance()->AddToken("SAMURAIFDC1","SAMURAIFDC1"); + NPS::DetectorFactory::getInstance()->AddDetector("SAMURAIFDC1",SamuraiFDC1::Construct); + } + }; + + proxy_nps_samuraiFDC1 p_nps_samuraiFDC1; +} + + diff --git a/NPSimulation/Detectors/Samurai/SamuraiFDC1.hh b/NPSimulation/Detectors/Samurai/SamuraiFDC1.hh new file mode 100644 index 0000000000000000000000000000000000000000..e18be19416240c61c3e789be4a0ed7f59284ac6d --- /dev/null +++ b/NPSimulation/Detectors/Samurai/SamuraiFDC1.hh @@ -0,0 +1,127 @@ +#ifndef Samurai_h +#define Samurai_h 1 +/***************************************************************************** + * Copyright (C) 2009-2021 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Omar Nasr contact address: omar.h.nasr@outlook.com * + * * + * Creation Date : septembre 2021 * + * Last update : septembre 2021 * + *---------------------------------------------------------------------------* + * Decription: * + * This class describe Samurai simulation * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + *****************************************************************************/ + +// C++ header +#include <string> +#include <vector> +using namespace std; + +// G4 headers +#include "G4ThreeVector.hh" +#include "G4RotationMatrix.hh" +#include "G4LogicalVolume.hh" +#include "G4MultiFunctionalDetector.hh" +//#include "G4VFastSimulationModel.hh" +#include "G4VSolid.hh" + +// NPTool header +#include "NPSVDetector.hh" +#include "NPInputParser.h" + +//#include "SamuraiFieldPropagation.hh" +#include "TSamuraiIdealData.h" + + +class SamuraiFDC1 : public NPS::VDetector{ + //////////////////////////////////////////////////// + /////// Default Constructor and Destructor ///////// + //////////////////////////////////////////////////// + public: + SamuraiFDC1() ; + virtual ~SamuraiFDC1() ; + + //////////////////////////////////////////////////// + /////// Specific Function of this Class /////////// + //////////////////////////////////////////////////// + public: + + // Cartezian FDC1 + void AddDetector(G4ThreeVector Mag_Pos, G4ThreeVector Offset); + + G4LogicalVolume* BuildFDC1(); + private: + + //Logical Volume + G4LogicalVolume* m_FDC1; + + // Visualisation Attributes + G4VisAttributes* m_VisFDC1; + + + //////////////////////////////////////////////////// + ////// Inherite from NPS::VDetector class ///////// + //////////////////////////////////////////////////// + public: + // Read stream at Configfile to pick-up parameters of detector (Position,...) + // Called in DetecorConstruction::ReadDetectorConfiguration Method + void ReadConfiguration(NPL::InputParser) ; + + // Construct detector and initialise 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::EndOfEventAction) + void ReadSensitive(const G4Event* event) ; + + public: + // Scorer + // Initialize the scorer(s) used by the FDC1 detector + void InitializeScorers() ; + + + // Associated Scorer + G4MultiFunctionalDetector* m_FDC1Scorer ; + //////////////////////////////////////////////////// + ///////////Event class to store Data//////////////// + //////////////////////////////////////////////////// + private: + //TSamuraiFDC1Data* m_Event; + ////////////////////////////////////////////////////////////////// + + TSamuraiIdealData* m_Event; + + //////////////////////////////////////////////////// + ///////////////Private intern Data////////////////// + //////////////////////////////////////////////////// + private: + //Detector coordinates + G4ThreeVector m_Pos; + + + // Needed for dynamic loading of the library + public: + static NPS::VDetector* Construct(); +}; +#endif + + + + + + + diff --git a/NPSimulation/Detectors/Samurai/SamuraiFDC2.cc b/NPSimulation/Detectors/Samurai/SamuraiFDC2.cc index d898c2ab4de76d78c7d449c3d15dc2ca77ea2cd8..7240c6fad95e7b7ad3c38e03e25b71ea1467b651 100644 --- a/NPSimulation/Detectors/Samurai/SamuraiFDC2.cc +++ b/NPSimulation/Detectors/Samurai/SamuraiFDC2.cc @@ -22,7 +22,6 @@ // C++ headers #include <sstream> #include <cmath> -#include <limits> //G4 Geometry object #include "G4Box.hh" @@ -37,12 +36,10 @@ #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4RegionStore.hh" -#include "G4FastSimulationManager.hh" -#include "G4UserLimits.hh" // NPTool header #include "SamuraiFDC2.hh" -#include "CalorimeterScorers.hh" +//#include "CalorimeterScorers.hh" #include "InteractionScorers.hh" #include "RootOutput.h" #include "MaterialManager.hh" @@ -61,16 +58,18 @@ namespace SamuraiFDC2_NS{ // Samurai magnet construction paramethers //Main outer box - const double FDC2_Width = 6700*mm; //(x) - const double FDC2_Height = 4640*mm;//(y) - const double FDC2_Depth = 500*mm;//(z) + const double FDC2_Width = 2616*mm; //(x) + const double FDC2_Height = 1156*mm;//(y) + const double FDC2_Depth = 876*mm;//(z) const string FDC2_Material = "G4_Fe"; + //Detector Number + const short int FDC2_DetectorNumber = 2; + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + // Samurai Specific Method SamuraiFDC2::SamuraiFDC2(){ @@ -80,7 +79,7 @@ SamuraiFDC2::SamuraiFDC2(){ m_FDC2 = NULL; //Scorer m_FDC2Scorer = NULL; - + //Ideal Data event m_Event = new TSamuraiIdealData; } @@ -98,40 +97,9 @@ void SamuraiFDC2::AddDetector(G4ThreeVector Mag_Pos, double Mag_Angle, G4ThreeVe return; } -/* -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void SamuraiFDC2::AddFDC2(double r, double theta, double phi, - double R, double Theta, double Phi, double Angle){ - - m_R_d = r; - m_Theta_d = theta; - m_Phi_d = phi; - - m_R = R; - m_Theta = Theta; - m_Phi = Phi; - m_Angle = Angle; - - return; -} -//Spherical Magnet -void SamuraiFDC2::AddMagnet(double R, double Theta, double Phi, double Angle){ - - - return; -} -//Cartezian Magnet -void SamuraiFDC2::AddMagnet(G4ThreeVector POS, double Angle){ - - m_R = POS.mag(); - m_Theta = POS.theta(); - m_Phi = POS.phi(); - m_Angle = Angle; - - return; -}*/ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + G4LogicalVolume* SamuraiFDC2::BuildFDC2(){ if(!m_FDC2){ //Shape - G4Box @@ -150,15 +118,12 @@ G4LogicalVolume* SamuraiFDC2::BuildFDC2(){ return m_FDC2; } - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + // Virtual Method of NPS::VDetector class // Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetectorConfiguration Method +// (Called in DetecorConstruction::ReadDetectorConfiguration Method) void SamuraiFDC2::ReadConfiguration(NPL::InputParser parser){ vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Samurai"); @@ -211,7 +176,7 @@ void SamuraiFDC2::ReadConfiguration(NPL::InputParser parser){ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... // Construct detector and inialise sensitive part. -// Called After DetectorConstruction::AddDetector Method +// (Called After DetectorConstruction::AddDetector Method) void SamuraiFDC2::ConstructDetector(G4LogicalVolume* world){ G4RotationMatrix* Rot = new G4RotationMatrix(); @@ -224,26 +189,22 @@ void SamuraiFDC2::ConstructDetector(G4LogicalVolume* world){ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... // Add Detector branch to the EventTree. // Called After DetecorConstruction::AddDetector Method -//FIXME - void SamuraiFDC2::InitializeRootOutput(){ RootOutput *pAnalysis = RootOutput::getInstance(); TTree *pTree = pAnalysis->GetTree(); if(!pTree->FindBranch("IdealData")){ - pTree->Branch("IdealData", "TSamuraiIdealData", &m_Event) ; //WATCH OUT !!!!!! + pTree->Branch("IdealData", "TSamuraiIdealData", &m_Event) ; } - pTree->SetBranchAddress("IdealData", &m_Event) ; //WATCH OUT !!!!!! + pTree->SetBranchAddress("IdealData", &m_Event); } - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + // Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion +// (Called at in the EventAction::EndOfEventAvtion) -//FIXME void SamuraiFDC2::ReadSensitive(const G4Event* event){ m_Event->Clear(); @@ -255,7 +216,7 @@ void SamuraiFDC2::ReadSensitive(const G4Event* event){ //vector<unsigned int> level = Scorer->GetLevel(i); //double Energy = RandGauss::shoot(Scorer->GetEnergy(i),SamuraiFDC2_NS::ResoEnergy); //double Energy = Scorer->GetEnergy(i); - short int detector = 2; + double energy = Scorer->GetEnergy(i); double brho = Scorer->GetBrho(i); double posx = Scorer->GetPositionX(i); @@ -264,38 +225,12 @@ void SamuraiFDC2::ReadSensitive(const G4Event* event){ double mom_mag = brho*Scorer->GetCharge(i); double theta = Scorer->GetTheta(i); double phi = Scorer->GetPhi(i); - m_Event->SetData(detector, energy, posx, posy, posz, mom_mag, theta, phi, brho); + m_Event->SetData(SamuraiFDC2_NS::FDC2_DetectorNumber, energy, posx, posy, posz, mom_mag, theta, phi, brho); } - /* - m_Event->Clear(); - - /////////// - // Calorimeter scorer - //CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_FDC2Scorer->GetPrimitive(0); - - //Interaction Scorer - InteractionScorers::PS_Interactions* Scorer= (InteractionScorers::PS_Interactions*) m_FDC2Scorer->GetPrimitive(0); - - unsigned int size = Scorer->GetMult(); - for(unsigned int i = 0 ; i < size ; i++){ - vector<unsigned int> level = Scorer->GetLevel(i); - //double Energy = RandGauss::shoot(Scorer->GetEnergy(i),SamuraiFDC2_NS::ResoEnergy); - double Energy = Scorer->GetEnergy(); - - if(Energy>SamuraiFDC2_NS::EnergyThreshold){ - double Time = RandGauss::shoot(Scorer->GetTime(i),SamuraiFDC2_NS::ResoTime); - int DetectorNbr = level[0]; - m_Event->SetEnergy(DetectorNbr,Energy); - m_Event->SetTime(DetectorNbr,Time); - } - }*/ } +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////// - -//FIXME void SamuraiFDC2::InitializeScorers() { // This check is necessary in case the geometry is reloaded bool already_exist = false; @@ -306,21 +241,17 @@ void SamuraiFDC2::InitializeScorers() { // Otherwise the scorer is initialised vector<int> level; level.push_back(0); - //G4VPrimitiveScorer* Calorimeter= new CalorimeterScorers::PS_Calorimeter("Calorimeter",level, 0) ; - G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; //WATCH OUT - //and register it to the multifunctionnal detector - //m_FDC2Scorer->RegisterPrimitive(Calorimeter); + //Interaction + G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; m_FDC2Scorer->RegisterPrimitive(Interaction); G4SDManager::GetSDMpointer()->AddNewDetector(m_FDC2Scorer) ; } - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //////////////////////////////////////////////////////////////////////////////// // Construct Method to be pass to the DetectorFactory // //////////////////////////////////////////////////////////////////////////////// + NPS::VDetector* SamuraiFDC2::Construct(){ return (NPS::VDetector*) new SamuraiFDC2(); } @@ -329,7 +260,7 @@ NPS::VDetector* SamuraiFDC2::Construct(){ //////////////////////////////////////////////////////////////////////////////// // Registering the construct method to the factory // //////////////////////////////////////////////////////////////////////////////// -extern"C" {////// WHAT IS THIS?? +extern"C" { class proxy_nps_samuraiFDC2{ public: proxy_nps_samuraiFDC2(){ diff --git a/NPSimulation/Detectors/Samurai/SamuraiFDC2.hh b/NPSimulation/Detectors/Samurai/SamuraiFDC2.hh index 79afe5eede1a14ed349b3b16ffdcf85006706fed..1dc277fc1347124b30879263f3a70a0e16cee23f 100644 --- a/NPSimulation/Detectors/Samurai/SamuraiFDC2.hh +++ b/NPSimulation/Detectors/Samurai/SamuraiFDC2.hh @@ -31,14 +31,14 @@ using namespace std; #include "G4RotationMatrix.hh" #include "G4LogicalVolume.hh" #include "G4MultiFunctionalDetector.hh" -#include "G4VFastSimulationModel.hh" +//#include "G4VFastSimulationModel.hh" #include "G4VSolid.hh" // NPTool header #include "NPSVDetector.hh" #include "NPInputParser.h" -#include "SamuraiFieldPropagation.hh" +//#include "SamuraiFieldPropagation.hh" #include "TSamuraiIdealData.h" @@ -55,18 +55,13 @@ class SamuraiFDC2 : public NPS::VDetector{ //////////////////////////////////////////////////// public: - // Cartesian fdc0 + // Cartezian FDC2 void AddDetector(G4ThreeVector Mag_Pos, double Mag_Angle, G4ThreeVector Offset, double Off_Angle); - // Spherical fdc0 - /*void AddFDC2(double R, double Theta, double Phi, double Angle, - double r, double theta, double phi);*/ - //G4VSolid* BuildRYokeSolid(); G4LogicalVolume* BuildFDC2(); private: - //Solids used for the magnet construction - //G4VSolid* m_RYokeSolid; + //Logical Volume G4LogicalVolume* m_FDC2; // Visualisation Attributes @@ -81,21 +76,21 @@ class SamuraiFDC2 : public NPS::VDetector{ // Called in DetecorConstruction::ReadDetectorConfiguration Method void ReadConfiguration(NPL::InputParser) ; - // Construct detector and inialise sensitive part. - // Called After DetecorConstruction::AddDetector Method + // Construct detector and initialise sensitive part. + // (Called After DetecorConstruction::AddDetector Method) void ConstructDetector(G4LogicalVolume* world) ; // Add Detector branch to the EventTree. - // Called After DetecorConstruction::AddDetector Method + // (Called After DetecorConstruction::AddDetector Method) void InitializeRootOutput() ; // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAction + // (Called at in the EventAction::EndOfEventAction) void ReadSensitive(const G4Event* event) ; public: // Scorer - // Initialize all Scorer used by the MUST2Array + // Initialize the scorer(s) used by the FDC2 detector void InitializeScorers() ; diff --git a/Projects/Samurai/Samurai.detector b/Projects/Samurai/Samurai.detector index 5ce30b423c92a9667738f7eca3d44143e16b4a93..53e981171413777e66ca006fa8570d48c60a3baf 100644 --- a/Projects/Samurai/Samurai.detector +++ b/Projects/Samurai/Samurai.detector @@ -9,7 +9,7 @@ Target Z= -10000 mm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Samurai - POS= 0 0 0 mm + POS= 0 0 10000 mm ANGLE= 30 deg % METHOD= 1 @@ -19,9 +19,10 @@ Samurai % fieldmap path STEPS_PER_METER= 1000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%SAMURAIFDC0 +SAMURAIFDC1 %XML= db/SAMURAIFDC0_20200109.xml %Offset= -0.00666226 0.102191 -3370.01 mm + Offset= -0.00666226 0.102191 -4370.01 mm %InvertX= 1 %InvertY= 0 %InvertD= 1 @@ -29,7 +30,7 @@ Samurai %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SAMURAIFDC2 %XML= db/SAMURAIFDC2.xml - Offset= 1000 1000 5000 mm + Offset= 1000 200 5000 mm OffAngle= 59.930 deg %-252.416 -0.228477 4122.57 mm %InvertX= 0