From a3b56d948e6994611d80e19a686591722a0af16e Mon Sep 17 00:00:00 2001 From: matta <matta@npt> Date: Tue, 8 Feb 2011 19:47:37 +0000 Subject: [PATCH] * Code Clean up in NPS - Suppress all Tab - Arrange indentation --- NPSimulation/include/AnnularS1.hh | 4 +- NPSimulation/include/Chamber.hh | 128 +- NPSimulation/include/DetectorConstruction.hh | 6 +- NPSimulation/include/DummyDetector.hh | 50 +- NPSimulation/include/EventGeneratorBeam.hh | 22 +- .../include/EventGeneratorPhaseSpace.hh | 126 +- .../include/EventGeneratorTransfert.hh | 64 +- .../EventGeneratorTransfertToResonance.hh | 198 +-- NPSimulation/include/GaspardTrackerAnnular.hh | 10 +- .../include/GaspardTrackerDummyShape.hh | 20 +- NPSimulation/include/GaspardTrackerModule.hh | 4 +- NPSimulation/include/GaspardTrackerSquare.hh | 2 +- NPSimulation/include/GeneralScorers.hh | 418 +++---- NPSimulation/include/HydeTrackerAnnular.hh | 10 +- NPSimulation/include/HydeTrackerDummyShape.hh | 32 +- NPSimulation/include/HydeTrackerModule.hh | 4 +- NPSimulation/include/HydeTrackerSquare.hh | 12 +- NPSimulation/include/HydeTrackerTrapezoid.hh | 10 +- NPSimulation/include/MUST2Array.hh | 174 +-- NPSimulation/include/Must2Scorers.hh | 152 +-- NPSimulation/include/ParisCluster.hh | 10 +- NPSimulation/include/ParisModule.hh | 4 +- NPSimulation/include/ParisPhoswich.hh | 10 +- NPSimulation/include/Plastic.hh | 96 +- .../include/PrimaryGeneratorAction.hh | 8 +- NPSimulation/include/ShieldClParis.hh | 6 +- NPSimulation/include/ShieldModule.hh | 4 +- NPSimulation/include/ShieldPhParis.hh | 6 +- NPSimulation/include/Target.hh | 162 +-- NPSimulation/include/ThinSi.hh | 78 +- NPSimulation/include/ThinSiScorers.hh | 50 +- NPSimulation/include/VDetector.hh | 16 +- NPSimulation/src/AnnularS1.cc | 18 +- NPSimulation/src/Chamber.cc | 156 +-- NPSimulation/src/DetectorConstruction.cc | 12 +- NPSimulation/src/DummyDetector.cc | 625 +++++----- NPSimulation/src/EventGeneratorBeam.cc | 236 ++-- NPSimulation/src/EventGeneratorIsotropic.cc | 196 +-- NPSimulation/src/EventGeneratorPhaseSpace.cc | 552 ++++----- NPSimulation/src/EventGeneratorTransfert.cc | 418 +++---- .../src/EventGeneratorTransfertToResonance.cc | 995 ++++++++------- NPSimulation/src/GaspardTrackerAnnular.cc | 38 +- NPSimulation/src/GaspardTrackerDummyShape.cc | 40 +- NPSimulation/src/GaspardTrackerSquare.cc | 54 +- NPSimulation/src/GaspardTrackerTrapezoid.cc | 54 +- NPSimulation/src/GeneralScorers.cc | 32 +- NPSimulation/src/HydeTrackerAnnular.cc | 32 +- NPSimulation/src/HydeTrackerDummyShape.cc | 40 +- NPSimulation/src/HydeTrackerSquare.cc | 50 +- NPSimulation/src/HydeTrackerTrapezoid.cc | 50 +- NPSimulation/src/MUST2Array.cc | 715 ++++++----- NPSimulation/src/Must2Scorers.cc | 56 +- NPSimulation/src/ParisCluster.cc | 328 ++--- NPSimulation/src/ParisPhoswich.cc | 334 +++--- NPSimulation/src/PhysicsList.cc | 52 +- NPSimulation/src/Plastic.cc | 1062 ++++++++--------- NPSimulation/src/PrimaryGeneratorAction.cc | 60 +- NPSimulation/src/ShieldClParis.cc | 174 +-- NPSimulation/src/ShieldPhParis.cc | 212 ++-- NPSimulation/src/Target.cc | 580 ++++----- NPSimulation/src/ThinSi.cc | 916 +++++++------- NPSimulation/src/ThinSiScorers.cc | 8 +- NPSimulation/src/W1.cc | 6 +- 63 files changed, 4986 insertions(+), 5011 deletions(-) diff --git a/NPSimulation/include/AnnularS1.hh b/NPSimulation/include/AnnularS1.hh index 71e6c97b2..50a8cbfcc 100644 --- a/NPSimulation/include/AnnularS1.hh +++ b/NPSimulation/include/AnnularS1.hh @@ -101,10 +101,10 @@ private: //////////////////////////////////////////////////// private: // Used for "By Point Definition" - vector<G4double> m_PosZ; + vector<G4double> m_PosZ; // Set to true if you want to see Telescope Frame in your visualisation - bool m_non_sensitive_part_visiualisation; + bool m_non_sensitive_part_visiualisation; }; diff --git a/NPSimulation/include/Chamber.hh b/NPSimulation/include/Chamber.hh index 1da4e750f..a543eaa10 100644 --- a/NPSimulation/include/Chamber.hh +++ b/NPSimulation/include/Chamber.hh @@ -40,71 +40,71 @@ using namespace std; class Chamber : public VDetector { - public: - Chamber(); - ~Chamber(){}; - - - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(string Path); - - // 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: - // Return Material from the Chamber Material Library - G4Material* GetMaterialFromLibrary(G4String MaterialName, G4double Temperature = 0, G4double Pressure = 0); - - // Generate a DEDX file table using the material used in the target - void WriteDEDXTable(G4ParticleDefinition* Particle,G4double Emin,G4double Emax); - - public: - G4double GetChamberRmin() {return m_ChamberRmin;} - G4double GetChamberRmax() {return m_ChamberRmax;} - G4double GetChamberPhiMin() {return m_ChamberPhiMin;} - G4double GetChamberPhiMax() {return m_ChamberPhiMax;} - G4double GetChamberThetaMin() {return m_ChamberThetaMin;} - G4double GetChamberThetaMax() {return m_ChamberThetaMax;} - G4Material* GetChamberMaterial() {return m_ChamberMaterial;} - //G4int GetChamberNbLayers() {return m_ChamberNbLayers;} - - - private: - // Chamber type : true = normal ; false = cryo - bool m_ChamberType; - - // Standard parameter - G4double m_ChamberRmin; - G4double m_ChamberRmax; - G4double m_ChamberPhiMin; - G4double m_ChamberPhiMax; - G4double m_ChamberThetaMin; - G4double m_ChamberThetaMax; - G4Material* m_ChamberMaterial; - G4int m_ChamberNbLayers; + public: + Chamber(); + ~Chamber(){}; + + + public: + // Read stream at Configfile to pick-up parameters of detector (Position,...) + // Called in DetecorConstruction::ReadDetextorConfiguration Method + void ReadConfiguration(string Path); + + // 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: + // Return Material from the Chamber Material Library + G4Material* GetMaterialFromLibrary(G4String MaterialName, G4double Temperature = 0, G4double Pressure = 0); + + // Generate a DEDX file table using the material used in the target + void WriteDEDXTable(G4ParticleDefinition* Particle,G4double Emin,G4double Emax); + + public: + G4double GetChamberRmin() {return m_ChamberRmin;} + G4double GetChamberRmax() {return m_ChamberRmax;} + G4double GetChamberPhiMin() {return m_ChamberPhiMin;} + G4double GetChamberPhiMax() {return m_ChamberPhiMax;} + G4double GetChamberThetaMin() {return m_ChamberThetaMin;} + G4double GetChamberThetaMax() {return m_ChamberThetaMax;} + G4Material* GetChamberMaterial() {return m_ChamberMaterial;} + //G4int GetChamberNbLayers() {return m_ChamberNbLayers;} + + + private: + // Chamber type : true = normal ; false = cryo + bool m_ChamberType; + + // Standard parameter + G4double m_ChamberRmin; + G4double m_ChamberRmax; + G4double m_ChamberPhiMin; + G4double m_ChamberPhiMax; + G4double m_ChamberThetaMin; + G4double m_ChamberThetaMax; + G4Material* m_ChamberMaterial; + G4int m_ChamberNbLayers; /* - // For Cryo Chamber - G4double m_ChamberTemperature; - G4double m_ChamberPressure; - G4double m_WindowsThickness; - G4Material* m_WindowsMaterial; - - // Positioning - G4double m_ChamberX; - G4double m_ChamberY; - G4double m_ChamberZ; + // For Cryo Chamber + G4double m_ChamberTemperature; + G4double m_ChamberPressure; + G4double m_WindowsThickness; + G4Material* m_WindowsMaterial; + + // Positioning + G4double m_ChamberX; + G4double m_ChamberY; + G4double m_ChamberZ; */ }; diff --git a/NPSimulation/include/DetectorConstruction.hh b/NPSimulation/include/DetectorConstruction.hh index e34f8d012..48a79b434 100644 --- a/NPSimulation/include/DetectorConstruction.hh +++ b/NPSimulation/include/DetectorConstruction.hh @@ -11,7 +11,7 @@ * Original Author: Adrien MATTA contact address: matta@ipno.in2p3.fr * * * * Creation Date : January 2009 * - * Last update : January 2010 * + * Last update : January 2010 * *---------------------------------------------------------------------------* * Decription: * * This Class manage the virtual detector and call their method. * @@ -76,8 +76,8 @@ private: // Data about the target Chamber* m_Chamber; public: // Getter and Setter - Target* GetTarget() {return m_Target;} - Chamber* GetChamber() {return m_Chamber;} + Target* GetTarget() {return m_Target;} + Chamber* GetChamber() {return m_Chamber;} }; #endif diff --git a/NPSimulation/include/DummyDetector.hh b/NPSimulation/include/DummyDetector.hh index 21b01f77d..89ccc759a 100644 --- a/NPSimulation/include/DummyDetector.hh +++ b/NPSimulation/include/DummyDetector.hh @@ -15,9 +15,9 @@ *---------------------------------------------------------------------------* * Decription: * * This class describe a simple Dummy Detector : * - * a simple cylinder of predifined material. user can choose to place it * + * a simple cylinder of predifined material. user can choose to place it * * where he want using spherical coordinate and choose between two naterial * - * * + * * * * *---------------------------------------------------------------------------* * Comment: * @@ -58,14 +58,14 @@ public: //////////////////////////////////////////////////// public: // By Angle Method - void AddDUMMYDetector( G4double R , - G4double Theta , - G4double Phi , - G4double DUMMYDetectorThickness , - G4double DUMMYDetectorRadius , - G4String Scintillator ); - - void VolumeMaker(G4ThreeVector Det_pos, int DetNumber,G4LogicalVolume* world) ; + void AddDUMMYDetector( G4double R , + G4double Theta , + G4double Phi , + G4double DUMMYDetectorThickness , + G4double DUMMYDetectorRadius , + G4String Scintillator ); + + void VolumeMaker(G4ThreeVector Det_pos, int DetNumber,G4LogicalVolume* world) ; //////////////////////////////////////////////////// ///////// Inherite from VDetector class /////////// //////////////////////////////////////////////////// @@ -87,18 +87,18 @@ public: void ReadSensitive(const G4Event* event) ; public: // Material - void InitializeMaterial() ; - // The dummy materials - G4Material* m_MaterialDUMMYDetector_material1 ; //the dummy material 2 - G4Material* m_MaterialDUMMYDetector_material2 ; //the dummy material 2 + void InitializeMaterial() ; + // The dummy materials + G4Material* m_MaterialDUMMYDetector_material1 ; //the dummy material 2 + G4Material* m_MaterialDUMMYDetector_material2 ; //the dummy material 2 - -public: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; + +public: // Scorer + // Initialize all Scorer used by the MUST2Array + void InitializeScorers() ; - // Silicon Associate Scorer - G4MultiFunctionalDetector* m_DUMMYDetectorScorer ; + // Silicon Associate Scorer + G4MultiFunctionalDetector* m_DUMMYDetectorScorer ; //////////////////////////////////////////////////// @@ -112,16 +112,16 @@ private: //////////////////////////////////////////////////// private: - vector<double> m_DUMMYDetectorThickness ; - vector<double> m_DUMMYDetectorRadius ; + vector<double> m_DUMMYDetectorThickness ; + vector<double> m_DUMMYDetectorRadius ; // Used for "By Angle Definition" vector<G4double> m_R ; // | vector<G4double> m_Theta ; // > Spherical coordinate DUMMYDetector volume center - vector<G4double> m_Phi ; // | + vector<G4double> m_Phi ; // | - // Scintillator type - vector<G4String> m_Scintillator ; + // Scintillator type + vector<G4String> m_Scintillator ; }; diff --git a/NPSimulation/include/EventGeneratorBeam.hh b/NPSimulation/include/EventGeneratorBeam.hh index e18dba96b..4a2f425f7 100644 --- a/NPSimulation/include/EventGeneratorBeam.hh +++ b/NPSimulation/include/EventGeneratorBeam.hh @@ -52,19 +52,19 @@ public: // Inherit from VEventGenerator Class private: // TTree to store initial value of beam and reaction - TInitialConditions* m_InitConditions; + TInitialConditions* m_InitConditions; - + private: // Source parameter - G4ParticleDefinition* m_particle; // Kind of particle to shoot - G4int m_beamA; - G4int m_beamZ; - G4double m_BeamEnergy; - G4double m_BeamEnergySpread; - G4double m_SigmaX; - G4double m_SigmaY; - G4double m_SigmaThetaX; - G4double m_SigmaPhiY; + G4ParticleDefinition* m_particle; // Kind of particle to shoot + G4int m_beamA; + G4int m_beamZ; + G4double m_BeamEnergy; + G4double m_BeamEnergySpread; + G4double m_SigmaX; + G4double m_SigmaY; + G4double m_SigmaThetaX; + G4double m_SigmaPhiY; private: // Target Value Target* m_Target; diff --git a/NPSimulation/include/EventGeneratorPhaseSpace.hh b/NPSimulation/include/EventGeneratorPhaseSpace.hh index 600d6cae0..a2bd958a4 100644 --- a/NPSimulation/include/EventGeneratorPhaseSpace.hh +++ b/NPSimulation/include/EventGeneratorPhaseSpace.hh @@ -19,7 +19,7 @@ * channel during an experiment. Manage up to 18 body phase space * *---------------------------------------------------------------------------* * Comment: * - * * + * * * * *****************************************************************************/ // C++ header @@ -39,68 +39,68 @@ using namespace std; class EventGeneratorPhaseSpace : public VEventGenerator { - public: // Constructors and Destructors - - // Default constructor used to allocate memory - EventGeneratorPhaseSpace(); - - // This is the constructor to be used - EventGeneratorPhaseSpace( G4ParticleDefinition* BeamParticle , - G4ParticleDefinition* TargetParticle , - vector<G4ParticleDefinition*> ReactionProducts , - double BeamEnergy , - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY ); - - // Default Destructor - virtual ~EventGeneratorPhaseSpace(); - - public: // Inherit from VEventGenerator class - void ReadConfiguration(string) ; - void GenerateEvent(G4Event*, G4ParticleGun*) ; - void SetTarget(Target* Target); - - private: // Particle Shoot Option - bool m_ShootLight ; - bool m_ShootHeavy ; - bool m_ShootDecayProduct ; - - private: // Value to store in the output tree : initial value of beam and reaction and phase space event weight - TInitialConditions* m_InitConditions; - // When the Phase Space Generator is called, the weight of the current configuration is return and stored in this variable - // Spectrum then need to be weighted by this paramater to be realistic - // NB: This procedure avoid long calculation time of the rejection methods previously instantiate and therefore allow simulation of manybody phase space decay - double m_EventWeight ; - - private: // Target Parameter - Target* m_Target; - - private: // Experimental Parameter - G4ParticleDefinition* m_BeamParticle ; - G4ParticleDefinition* m_TargetParticle ; - double m_BeamEnergy ; - double m_BeamEnergySpread ; - double m_SigmaX ; - double m_SigmaY ; - double m_SigmaThetaX ; - double m_SigmaPhiY ; - vector<G4ParticleDefinition*> m_ReactionProducts ; - - private: //Other - void InitializeRootOutput() ; - - void SetEverything( G4ParticleDefinition* BeamParticle , - G4ParticleDefinition* TargetParticle , - vector<G4ParticleDefinition*> ReactionProducts , - double BeamEnergy , - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY ); + public: // Constructors and Destructors + + // Default constructor used to allocate memory + EventGeneratorPhaseSpace(); + + // This is the constructor to be used + EventGeneratorPhaseSpace( G4ParticleDefinition* BeamParticle, + G4ParticleDefinition* TargetParticle, + vector<G4ParticleDefinition*> ReactionProducts, + double BeamEnergy, + double BeamEnergySpread, + double SigmaX, + double SigmaY, + double SigmaThetaX, + double SigmaPhiY ); + + // Default Destructor + virtual ~EventGeneratorPhaseSpace(); + + public: // Inherit from VEventGenerator class + void ReadConfiguration(string); + void GenerateEvent(G4Event*, G4ParticleGun*); + void SetTarget(Target* Target); + + private: // Particle Shoot Option + bool m_ShootLight; + bool m_ShootHeavy; + bool m_ShootDecayProduct; + + private: // Value to store in the output tree : initial value of beam and reaction and phase space event weight + TInitialConditions* m_InitConditions; + // When the Phase Space Generator is called, the weight of the current configuration is return and stored in this variable + // Spectrum then need to be weighted by this paramater to be realistic + // NB: This procedure avoid long calculation time of the rejection methods previously instantiate and therefore allow simulation of manybody phase space decay + double m_EventWeight; + + private: // Target Parameter + Target* m_Target; + + private: // Experimental Parameter + G4ParticleDefinition* m_BeamParticle ; + G4ParticleDefinition* m_TargetParticle ; + double m_BeamEnergy ; + double m_BeamEnergySpread ; + double m_SigmaX ; + double m_SigmaY ; + double m_SigmaThetaX ; + double m_SigmaPhiY ; + vector<G4ParticleDefinition*> m_ReactionProducts ; + + private: //Other + void InitializeRootOutput() ; + + void SetEverything( G4ParticleDefinition* BeamParticle , + G4ParticleDefinition* TargetParticle , + vector<G4ParticleDefinition*> ReactionProducts , + double BeamEnergy , + double BeamEnergySpread , + double SigmaX , + double SigmaY , + double SigmaThetaX , + double SigmaPhiY ); }; #endif diff --git a/NPSimulation/include/EventGeneratorTransfert.hh b/NPSimulation/include/EventGeneratorTransfert.hh index 819acf490..b1676d2e8 100644 --- a/NPSimulation/include/EventGeneratorTransfert.hh +++ b/NPSimulation/include/EventGeneratorTransfert.hh @@ -49,21 +49,21 @@ public: // Constructors and Destructors EventGeneratorTransfert(); // This is the constructor to be used - EventGeneratorTransfert(string name1 , // Beam nuclei - string name2 , // Target nuclei - string name3 , // Product of reaction - string name4 , // Product of reaction - double BeamEnergy , // Beam Energy - double ExcitationEnergyLight , // Excitation of Light Nuclei - double ExcitationEnergyHeavy , // Excitation of Heavy Nuclei - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY , - bool ShootLight , - bool ShootHeavy , - string Path); // Path of the differentiel Cross Section + EventGeneratorTransfert( string name1 , // Beam nuclei + string name2 , // Target nuclei + string name3 , // Product of reaction + string name4 , // Product of reaction + double BeamEnergy , // Beam Energy + double ExcitationEnergyLight , // Excitation of Light Nuclei + double ExcitationEnergyHeavy , // Excitation of Heavy Nuclei + double BeamEnergySpread , + double SigmaX , + double SigmaY , + double SigmaThetaX , + double SigmaPhiY , + bool ShootLight , + bool ShootHeavy , + string Path ); // Path of the differentiel Cross Section // Default Destructor virtual ~EventGeneratorTransfert(); @@ -72,7 +72,7 @@ public: // Constructors and Destructors public: // Inherit from VEventGenerator class void ReadConfiguration(string); void GenerateEvent(G4Event*, G4ParticleGun*); - void SetTarget(Target* Target) ; + void SetTarget(Target* Target) ; private: // Particle Shoot Option @@ -98,28 +98,28 @@ private: // Beam Parameters private: // TTree to store initial value of beam and reaction - TInitialConditions* m_InitConditions; + TInitialConditions* m_InitConditions; // Other methods void Print() const; void InitializeRootOutput(); - void SetEverything(string name1 , // Beam nuclei - string name2 , // Target nuclei - string name3 , // Product of reaction - string name4 , // Product of reaction - double BeamEnergy , // Beam Energy - double ExcitationEnergyLight , // Excitation of Light Nuclei - double ExcitationEnergyHeavy , // Excitation of Heavy Nuclei - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY , - bool ShootLight , - bool ShootHeavy , - string Path); // Path of the differentiel Cross Section + void SetEverything( string name1 , // Beam nuclei + string name2 , // Target nuclei + string name3 , // Product of reaction + string name4 , // Product of reaction + double BeamEnergy , // Beam Energy + double ExcitationEnergyLight , // Excitation of Light Nuclei + double ExcitationEnergyHeavy , // Excitation of Heavy Nuclei + double BeamEnergySpread , + double SigmaX , + double SigmaY , + double SigmaThetaX , + double SigmaPhiY , + bool ShootLight , + bool ShootHeavy , + string Path ); // Path of the differentiel Cross Section }; #endif diff --git a/NPSimulation/include/EventGeneratorTransfertToResonance.hh b/NPSimulation/include/EventGeneratorTransfertToResonance.hh index 579a1d970..5557b49aa 100644 --- a/NPSimulation/include/EventGeneratorTransfertToResonance.hh +++ b/NPSimulation/include/EventGeneratorTransfertToResonance.hh @@ -17,12 +17,12 @@ * This event Generator is used to simulated two body TransfertReaction. * * A Phase Space calculation is then performed to decay the Heavy product. * * The TGenPhaseSpace from ROOT is used to calculate a phase space decay * - * with flat distribution * + * with flat distribution * *---------------------------------------------------------------------------* * Comment: * * + 20/01/2011: Add support for excitation energy for light ejectile * * (N. de Sereville) * - * * + * * * * *****************************************************************************/ // C++ header @@ -45,103 +45,103 @@ using namespace NPL ; class EventGeneratorTransfertToResonance : public VEventGenerator { - public: // Constructors and Destructors - - // Default constructor used to allocate memory - EventGeneratorTransfertToResonance(); - - // This is the constructor to be used - EventGeneratorTransfertToResonance(string name1 , //Beam nuclei - string name2 , //Target nuclei - string name3 , //Product of reaction - string name4 , //Product of reaction - double BeamEnergy , //Beam Energy - double ExcitationEnergyLight , //Excitation of Light Nuclei - double ExcitationEnergyHeavy , //Excitation of Heavy Nuclei - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY, - double ResonanceWidth, - int ResonanceDecayZ , - int ResonanceDecayA , - bool ShootLight , - bool ShootHeavy , - bool ShootDecayProduct , - string Path); //Path of the differentiel Cross Section - - // Default Destructor - virtual ~EventGeneratorTransfertToResonance(); - - public: // Inherit from VEventGenerator class - void ReadConfiguration(string) ; - void GenerateEvent(G4Event*, G4ParticleGun*) ; - void SetTarget(Target* Target); - - private: // Particle Shoot Option - bool m_ShootLight ; - bool m_ShootHeavy ; - bool m_ShootDecayProduct ; - - private: // TTree to store initial value of beam and reaction - TInitialConditions* m_InitConditions; - - private: // Beam Parameter - double m_BeamEnergy ; - double m_BeamEnergySpread ; - double m_SigmaX ; - double m_SigmaY ; - double m_SigmaThetaX ; - double m_SigmaPhiY ; - - private: // Target Parameter - Target* m_Target; - - private: // Reaction - Reaction* m_Reaction ; - - private: // Resonance decay channel - double m_ResonanceWidth ; - double m_ResonanceMean ; - int m_ResonanceDecayZ ; - int m_ResonanceDecayA ; - - // When the Phase Space Generator is called, the weight of the current configuration is return and stored in this variable - // Spectrum then need to be weighted by this paramater to be realistic - // NB: This procedure avoid long calculation time of the rejection methods previously instantiate and therefore allow simulation of manybody phase space decay - double m_EventWeight ; - - //Other - void InitializeRootOutput() ; - void ResonanceDecay( G4double EnergyHeavy , - G4double ThetaHeavy , - G4double PhiHeavy , - G4double x0 , - G4double y0 , - G4double z0 , - G4Event* anEvent , - G4ParticleGun* particleGun); - - void SetEverything(string name1 , //Beam nuclei - string name2 , //Target nuclei - string name3 , //Product of reaction - string name4 , //Product of reaction - double BeamEnergy , //Beam Energy - double ExcitationEnergyLight , //Excitation of Light Nuclei - double ExcitationEnergyHeavy , //Excitation of Heavy Nuclei - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY , - double ResonanceWidth, - int ResonanceDecayZ , - int ResonanceDecayA , - bool ShootLight , - bool ShootHeavy , - bool ShootDecayProduct , - string Path); //Path of the differentiel Cross Section + public: // Constructors and Destructors + + // Default constructor used to allocate memory + EventGeneratorTransfertToResonance(); + + // This is the constructor to be used + EventGeneratorTransfertToResonance( string name1 , //Beam nuclei + string name2 , //Target nuclei + string name3 , //Product of reaction + string name4 , //Product of reaction + double BeamEnergy , //Beam Energy + double ExcitationEnergyLight , //Excitation of Light Nuclei + double ExcitationEnergyHeavy , //Excitation of Heavy Nuclei + double BeamEnergySpread , + double SigmaX , + double SigmaY , + double SigmaThetaX , + double SigmaPhiY , + double ResonanceWidth , + int ResonanceDecayZ , + int ResonanceDecayA , + bool ShootLight , + bool ShootHeavy , + bool ShootDecayProduct , + string Path ); //Path of the differentiel Cross Section + + // Default Destructor + virtual ~EventGeneratorTransfertToResonance(); + + public: // Inherit from VEventGenerator class + void ReadConfiguration(string); + void GenerateEvent(G4Event*, G4ParticleGun*); + void SetTarget(Target* Target); + + private: // Particle Shoot Option + bool m_ShootLight; + bool m_ShootHeavy; + bool m_ShootDecayProduct; + + private: // TTree to store initial value of beam and reaction + TInitialConditions* m_InitConditions; + + private: // Beam Parameter + double m_BeamEnergy ; + double m_BeamEnergySpread ; + double m_SigmaX ; + double m_SigmaY ; + double m_SigmaThetaX ; + double m_SigmaPhiY ; + + private: // Target Parameter + Target* m_Target; + + private: // Reaction + Reaction* m_Reaction ; + + private: // Resonance decay channel + double m_ResonanceWidth ; + double m_ResonanceMean ; + int m_ResonanceDecayZ ; + int m_ResonanceDecayA ; + + // When the Phase Space Generator is called, the weight of the current configuration is return and stored in this variable + // Spectrum then need to be weighted by this paramater to be realistic + // NB: This procedure avoid long calculation time of the rejection methods previously instantiate and therefore allow simulation of manybody phase space decay + double m_EventWeight ; + + //Other + void InitializeRootOutput() ; + void ResonanceDecay( G4double EnergyHeavy , + G4double ThetaHeavy , + G4double PhiHeavy , + G4double x0 , + G4double y0 , + G4double z0 , + G4Event* anEvent , + G4ParticleGun* particleGun ); + + void SetEverything( string name1 , //Beam nuclei + string name2 , //Target nuclei + string name3 , //Product of reaction + string name4 , //Product of reaction + double BeamEnergy , //Beam Energy + double ExcitationEnergyLight , //Excitation of Light Nuclei + double ExcitationEnergyHeavy , //Excitation of Heavy Nuclei + double BeamEnergySpread , + double SigmaX , + double SigmaY , + double SigmaThetaX , + double SigmaPhiY , + double ResonanceWidth , + int ResonanceDecayZ , + int ResonanceDecayA , + bool ShootLight , + bool ShootHeavy , + bool ShootDecayProduct , + string Path ); //Path of the differentiel Cross Section }; #endif diff --git a/NPSimulation/include/GaspardTrackerAnnular.hh b/NPSimulation/include/GaspardTrackerAnnular.hh index 042e22179..058813188 100644 --- a/NPSimulation/include/GaspardTrackerAnnular.hh +++ b/NPSimulation/include/GaspardTrackerAnnular.hh @@ -109,11 +109,11 @@ private: vector<G4double> m_Rmax; // for debugging purpose - G4ThreeVector MMpos; - G4ThreeVector MMu; - G4ThreeVector MMv; - G4ThreeVector MMw; - G4ThreeVector CT; + G4ThreeVector MMpos; + G4ThreeVector MMu; + G4ThreeVector MMv; + G4ThreeVector MMw; + G4ThreeVector CT; }; diff --git a/NPSimulation/include/GaspardTrackerDummyShape.hh b/NPSimulation/include/GaspardTrackerDummyShape.hh index bed592c4e..85e3f7857 100644 --- a/NPSimulation/include/GaspardTrackerDummyShape.hh +++ b/NPSimulation/include/GaspardTrackerDummyShape.hh @@ -106,7 +106,7 @@ public: // deriving from GaspardTrackerModule // This is mandatory since the GaspardTracker*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// @@ -147,10 +147,10 @@ private: namespace GPDDUMMYSHAPE { // Resolution -// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoFirstStage = 0.0213; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.0426; // = 100 keV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0.0426; // = 100 keV of resolution // Unit is MeV/2.35 +// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 + const G4double ResoFirstStage = 0.0213; // = 50 keV of Resolution // Unit is MeV/2.35 + const G4double ResoSecondStage = 0.0426; // = 100 keV of resolution // Unit is MeV/2.35 + const G4double ResoThirdStage = 0.0426; // = 100 keV of resolution // Unit is MeV/2.35 const G4double ResoTimeGpd = 0.212765957;// = 500ps // Unit is ns/2.35 // Geometry for the mother volume containing the different layers of your dummy shape module @@ -168,11 +168,11 @@ namespace GPDDUMMYSHAPE // const G4double FirstStageThickness = 2*mm; // for testing the excitation energy reconstruction // const G4double FirstStageThickness = 1.3*cm; -// const G4int NumberOfStrips = 10; // 5 mm strip pitch -// const G4int NumberOfStrips = 25; // 2 mm strip pitch -// const G4int NumberOfStrips = 50; // 1 mm strip pitch - const G4int NumberOfStrips = 100; // 0.5 mm strip pitch -// const G4int NumberOfStrips = 500; // 0.1 mm strip pitch +// const G4int NumberOfStrips = 10; // 5 mm strip pitch +// const G4int NumberOfStrips = 25; // 2 mm strip pitch +// const G4int NumberOfStrips = 50; // 1 mm strip pitch + const G4int NumberOfStrips = 100; // 0.5 mm strip pitch +// const G4int NumberOfStrips = 500; // 0.1 mm strip pitch // Second stage const G4double SecondStageFace = FirstStageFace; diff --git a/NPSimulation/include/GaspardTrackerModule.hh b/NPSimulation/include/GaspardTrackerModule.hh index 489643a65..43335d27f 100644 --- a/NPSimulation/include/GaspardTrackerModule.hh +++ b/NPSimulation/include/GaspardTrackerModule.hh @@ -71,11 +71,11 @@ public: void InitializeIndex(); public: - TGaspardTrackerData* GetEventPointer() {return ms_Event;}; + TGaspardTrackerData* GetEventPointer() {return ms_Event;}; protected: // Class to store the result of simulation - static TGaspardTrackerData* ms_Event; + static TGaspardTrackerData* ms_Event; // Set to true if you want this stage on you telescope vector<bool> m_wFirstStage; diff --git a/NPSimulation/include/GaspardTrackerSquare.hh b/NPSimulation/include/GaspardTrackerSquare.hh index 02e97477a..97354b96f 100644 --- a/NPSimulation/include/GaspardTrackerSquare.hh +++ b/NPSimulation/include/GaspardTrackerSquare.hh @@ -104,7 +104,7 @@ public: // deriving from GaspardTrackerModule // This is mandatory since the GaspardTracker*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// diff --git a/NPSimulation/include/GeneralScorers.hh b/NPSimulation/include/GeneralScorers.hh index 063db646c..59d77d7f0 100644 --- a/NPSimulation/include/GeneralScorers.hh +++ b/NPSimulation/include/GeneralScorers.hh @@ -28,215 +28,215 @@ #include "G4THitsMap.hh" namespace GENERALSCORERS - { - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - // This Threshold is used in the above scorer. Any energy deposit under this threshold will not create an entry. - const double TriggerThreshold = 100*keV ; - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - // The following function is used in many scorer. following the Detector Volume Nomenclature - // DetectorNameX_SubPart_SubPart - // where X stand for the detector number. - - int PickUpDetectorNumber(G4Step* aStep, std::string DetName); - - - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSDetectorNumber : public G4VPrimitiveScorer - { - - public: // with description - PSDetectorNumber(G4String name, G4String VolumeName = "xxx", G4int depth = 0 ); - virtual ~PSDetectorNumber(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4int>* EvtMap; - - }; - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSEnergy : public G4VPrimitiveScorer - { - - public: // with description - PSEnergy(G4String name, G4String VolumeName, G4int depth); - virtual ~PSEnergy(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; - }; - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSTOF : public G4VPrimitiveScorer - { - - public: // with description - PSTOF(G4String name, G4String VolumeName, G4int depth); - virtual ~PSTOF(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; - }; - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSInteractionCoordinatesX : public G4VPrimitiveScorer - { - public: // with description - PSInteractionCoordinatesX(G4String name, G4String VolumeName, G4int depth); - virtual ~PSInteractionCoordinatesX(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; - }; - - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSInteractionCoordinatesY : public G4VPrimitiveScorer - { - public: // with description - PSInteractionCoordinatesY(G4String name, G4String VolumeName, G4int depth); - virtual ~PSInteractionCoordinatesY(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; - }; - - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSInteractionCoordinatesZ : public G4VPrimitiveScorer - { - public: // with description - PSInteractionCoordinatesZ(G4String name, G4String VolumeName, G4int depth); - virtual ~PSInteractionCoordinatesZ(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; - }; - - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSInteractionCoordinatesAngleTheta : public G4VPrimitiveScorer - { - public: // with description - PSInteractionCoordinatesAngleTheta(G4String name, G4String VolumeName, G4int depth); - virtual ~PSInteractionCoordinatesAngleTheta(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; - }; - - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - class PSInteractionCoordinatesAnglePhi : public G4VPrimitiveScorer - { - public: // with description - PSInteractionCoordinatesAnglePhi(G4String name, G4String VolumeName, G4int depth); - virtual ~PSInteractionCoordinatesAnglePhi(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4String m_VolumeName; - G4int HCID; - G4THitsMap<G4double>* EvtMap; - }; - - - - } + { + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + // This Threshold is used in the above scorer. Any energy deposit under this threshold will not create an entry. + const double TriggerThreshold = 100*keV ; + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + // The following function is used in many scorer. following the Detector Volume Nomenclature + // DetectorNameX_SubPart_SubPart + // where X stand for the detector number. + + int PickUpDetectorNumber(G4Step* aStep, std::string DetName); + + + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSDetectorNumber : public G4VPrimitiveScorer + { + + public: // with description + PSDetectorNumber(G4String name, G4String VolumeName = "xxx", G4int depth = 0 ); + virtual ~PSDetectorNumber(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4int>* EvtMap; + + }; + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSEnergy : public G4VPrimitiveScorer + { + + public: // with description + PSEnergy(G4String name, G4String VolumeName, G4int depth); + virtual ~PSEnergy(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSTOF : public G4VPrimitiveScorer + { + + public: // with description + PSTOF(G4String name, G4String VolumeName, G4int depth); + virtual ~PSTOF(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSInteractionCoordinatesX : public G4VPrimitiveScorer + { + public: // with description + PSInteractionCoordinatesX(G4String name, G4String VolumeName, G4int depth); + virtual ~PSInteractionCoordinatesX(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; + + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSInteractionCoordinatesY : public G4VPrimitiveScorer + { + public: // with description + PSInteractionCoordinatesY(G4String name, G4String VolumeName, G4int depth); + virtual ~PSInteractionCoordinatesY(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; + + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSInteractionCoordinatesZ : public G4VPrimitiveScorer + { + public: // with description + PSInteractionCoordinatesZ(G4String name, G4String VolumeName, G4int depth); + virtual ~PSInteractionCoordinatesZ(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; + + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSInteractionCoordinatesAngleTheta : public G4VPrimitiveScorer + { + public: // with description + PSInteractionCoordinatesAngleTheta(G4String name, G4String VolumeName, G4int depth); + virtual ~PSInteractionCoordinatesAngleTheta(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; + + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PSInteractionCoordinatesAnglePhi : public G4VPrimitiveScorer + { + public: // with description + PSInteractionCoordinatesAnglePhi(G4String name, G4String VolumeName, G4int depth); + virtual ~PSInteractionCoordinatesAnglePhi(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4String m_VolumeName; + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; + + + + } diff --git a/NPSimulation/include/HydeTrackerAnnular.hh b/NPSimulation/include/HydeTrackerAnnular.hh index 477104248..d7b219030 100644 --- a/NPSimulation/include/HydeTrackerAnnular.hh +++ b/NPSimulation/include/HydeTrackerAnnular.hh @@ -109,11 +109,11 @@ private: vector<G4double> m_Rmax; // for debugging purpose - G4ThreeVector MMpos; - G4ThreeVector MMu; - G4ThreeVector MMv; - G4ThreeVector MMw; - G4ThreeVector CT; + G4ThreeVector MMpos; + G4ThreeVector MMu; + G4ThreeVector MMv; + G4ThreeVector MMw; + G4ThreeVector CT; }; diff --git a/NPSimulation/include/HydeTrackerDummyShape.hh b/NPSimulation/include/HydeTrackerDummyShape.hh index 3d260ad59..8564b8e32 100644 --- a/NPSimulation/include/HydeTrackerDummyShape.hh +++ b/NPSimulation/include/HydeTrackerDummyShape.hh @@ -106,7 +106,7 @@ public: // deriving from HydeTrackerModule // This is mandatory since the HydeTracker*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// @@ -141,13 +141,13 @@ private: namespace HYDDUMMYSHAPE { // Resolution -// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 - //const G4double ResoFirstStage = 0.0213; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoFirstStage = 0.0426; // = 100 keV of Resolution // Unit is MeV/2.35 - //const G4double ResoSecondStage = 0.00426426; // = 100 keV of resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.0128; // = 30 keV of resolution // Unit is MeV/2.35 - //const G4double ResoThirdStage = 0.0426; // = 100 keV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0.0128; // = 30 keV of resolution // Unit is MeV/2.35 +// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 + //const G4double ResoFirstStage = 0.0213; // = 50 keV of Resolution // Unit is MeV/2.35 + const G4double ResoFirstStage = 0.0426; // = 100 keV of Resolution // Unit is MeV/2.35 + //const G4double ResoSecondStage = 0.00426426; // = 100 keV of resolution // Unit is MeV/2.35 + const G4double ResoSecondStage = 0.0128; // = 30 keV of resolution // Unit is MeV/2.35 + //const G4double ResoThirdStage = 0.0426; // = 100 keV of resolution // Unit is MeV/2.35 + const G4double ResoThirdStage = 0.0128; // = 30 keV of resolution // Unit is MeV/2.35 const G4double ResoTimeGpd = 0.212765957;// = 500ps // Unit is ns/2.35 // Geometry for the mother volume containing the different layers of your dummy shape module @@ -167,14 +167,14 @@ namespace HYDDUMMYSHAPE // const G4double FirstStageThickness = 2*mm; // for testing the excitation energy reconstruction // const G4double FirstStageThickness = 1.3*cm; -// const G4int NumberOfStrips = 10; // 5 mm strip pitch -// const G4int NumberOfStrips = 16; // 3.125 mm strip pitch -// const G4int NumberOfStrips = 25; // 2 mm strip pitch -// const G4int NumberOfStrips = 50; // 1 mm strip pitch -// const G4int NumberOfStrips = 64; // 0.781 mm strip pitch -// const G4int NumberOfStrips = 100; // 0.5 mm strip pitch - const G4int NumberOfStrips = 16; // 0.391 mm strip pitch -// const G4int NumberOfStrips = 500; // 0.1 mm strip pitch +// const G4int NumberOfStrips = 10; // 5 mm strip pitch +// const G4int NumberOfStrips = 16; // 3.125 mm strip pitch +// const G4int NumberOfStrips = 25; // 2 mm strip pitch +// const G4int NumberOfStrips = 50; // 1 mm strip pitch +// const G4int NumberOfStrips = 64; // 0.781 mm strip pitch +// const G4int NumberOfStrips = 100; // 0.5 mm strip pitch + const G4int NumberOfStrips = 16; // 0.391 mm strip pitch +// const G4int NumberOfStrips = 500; // 0.1 mm strip pitch // Second stage const G4double SecondStageFace = FirstStageFace; diff --git a/NPSimulation/include/HydeTrackerModule.hh b/NPSimulation/include/HydeTrackerModule.hh index 217572af0..d3c8cdc13 100644 --- a/NPSimulation/include/HydeTrackerModule.hh +++ b/NPSimulation/include/HydeTrackerModule.hh @@ -71,11 +71,11 @@ public: void InitializeIndex(); public: - THydeTrackerData* GetEventPointer() {return ms_Event;}; + THydeTrackerData* GetEventPointer() {return ms_Event;}; protected: // Class to store the result of simulation - static THydeTrackerData* ms_Event; + static THydeTrackerData* ms_Event; // Set to true if you want this stage on you telescope vector<bool> m_wFirstStage; diff --git a/NPSimulation/include/HydeTrackerSquare.hh b/NPSimulation/include/HydeTrackerSquare.hh index 43574df26..be0a871e0 100644 --- a/NPSimulation/include/HydeTrackerSquare.hh +++ b/NPSimulation/include/HydeTrackerSquare.hh @@ -104,7 +104,7 @@ public: // deriving from HydeTrackerModule // This is mandatory since the HydeTracker*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// @@ -134,11 +134,11 @@ private: vector<G4double> m_beta_w ; // | // for debugging purpose - G4ThreeVector MMpos; - G4ThreeVector MMu; - G4ThreeVector MMv; - G4ThreeVector MMw; - G4ThreeVector CT; + G4ThreeVector MMpos; + G4ThreeVector MMu; + G4ThreeVector MMv; + G4ThreeVector MMw; + G4ThreeVector CT; }; diff --git a/NPSimulation/include/HydeTrackerTrapezoid.hh b/NPSimulation/include/HydeTrackerTrapezoid.hh index 535a94024..63d7a2eb3 100644 --- a/NPSimulation/include/HydeTrackerTrapezoid.hh +++ b/NPSimulation/include/HydeTrackerTrapezoid.hh @@ -134,11 +134,11 @@ private: vector<G4double> m_beta_w ; // | // for debugging purpose - G4ThreeVector MMpos; - G4ThreeVector MMu; - G4ThreeVector MMv; - G4ThreeVector MMw; - G4ThreeVector CT; + G4ThreeVector MMpos; + G4ThreeVector MMu; + G4ThreeVector MMv; + G4ThreeVector MMw; + G4ThreeVector CT; }; diff --git a/NPSimulation/include/MUST2Array.hh b/NPSimulation/include/MUST2Array.hh index b2d794b38..f6def0597 100644 --- a/NPSimulation/include/MUST2Array.hh +++ b/NPSimulation/include/MUST2Array.hh @@ -40,30 +40,30 @@ namespace MUST2 const G4double ResoStrip = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 // Geometry - const G4double FaceFront = 11.*cm ; - const G4double FaceBack = 16.5*cm ; - const G4double Length = 7.2*cm ; - - const G4double AluStripThickness = 0.4*micrometer ; - const G4double SiliconThickness = 300*micrometer ; - const G4double SiliconFace = 98*mm ; - const G4double VacBoxThickness = 3*cm ; - - const G4double SiLiThickness = 5.1*mm ; // Must be checked - const G4double SiLiFaceX = 48.25*mm ; - const G4double SiLiFaceY = 92*mm ; - const G4double MylarCsIThickness = 3*micrometer ; + const G4double FaceFront = 11.*cm ; + const G4double FaceBack = 16.5*cm ; + const G4double Length = 7.2*cm ; + + const G4double AluStripThickness = 0.4*micrometer ; + const G4double SiliconThickness = 300*micrometer ; + const G4double SiliconFace = 98*mm ; + const G4double VacBoxThickness = 3*cm ; + + const G4double SiLiThickness = 5.1*mm; // Must be checked + const G4double SiLiFaceX = 48.25*mm; + const G4double SiLiFaceY = 92*mm; + const G4double MylarCsIThickness = 3*micrometer; const G4double CsIThickness = 4.*cm + 2*MylarCsIThickness ; - const G4double CsIFaceFront = 12.2*cm ; - const G4double CsIFaceBack = 16*cm ; - const G4double DistInterCsI = 0.2 * mm; + const G4double CsIFaceFront = 12.2*cm; + const G4double CsIFaceBack = 16*cm; + const G4double DistInterCsI = 0.2*mm; // Starting at the front and going to CsI - const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness ; - const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*SiliconThickness ; - const G4double AluStripBack_PosZ = Silicon_PosZ + 0.5*SiliconThickness + 0.5*AluStripThickness ; - const G4double VacBox_PosZ = AluStripBack_PosZ + 0.5*AluStripThickness + 0.5* VacBoxThickness ; - const G4double CsI_PosZ = VacBox_PosZ + 0.5*VacBoxThickness + 0.5*CsIThickness ; + const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness; + const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*SiliconThickness; + const G4double AluStripBack_PosZ = Silicon_PosZ + 0.5*SiliconThickness + 0.5*AluStripThickness; + const G4double VacBox_PosZ = AluStripBack_PosZ + 0.5*AluStripThickness + 0.5* VacBoxThickness; + const G4double CsI_PosZ = VacBox_PosZ + 0.5*VacBoxThickness + 0.5*CsIThickness; } class MUST2Array : public VDetector @@ -80,33 +80,33 @@ public: //////////////////////////////////////////////////// public: // By Position Method - void AddTelescope(G4ThreeVector TL , - G4ThreeVector BL , - G4ThreeVector BR , - G4ThreeVector CT , - bool wSi , - bool wSiLi , - bool wCsI); + void AddTelescope( G4ThreeVector TL , + G4ThreeVector BL , + G4ThreeVector BR , + G4ThreeVector CT , + bool wSi , + bool wSiLi , + bool wCsI ); // By Angle Method - void AddTelescope(G4double R , - G4double Theta , - G4double Phi , - G4double beta_u , - G4double beta_v , - G4double beta_w , - bool wSi , - bool wSiLi , - bool wCsI); + void AddTelescope( G4double R , + G4double Theta , + G4double Phi , + G4double beta_u , + G4double beta_v , + G4double beta_w , + bool wSi , + bool wSiLi , + bool wCsI ); // Effectively construct Volume // Avoid to have two time same code for Angle and Point definition - void VolumeMaker(G4int TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wSi , - bool wSiLi , - bool wCsI , - G4LogicalVolume* world); + void VolumeMaker( G4int TelescopeNumber , + G4ThreeVector MMpos , + G4RotationMatrix* MMrot , + bool wSi , + bool wSiLi , + bool wCsI , + G4LogicalVolume* world ); //////////////////////////////////////////////////// @@ -115,26 +115,26 @@ public: public: // Read stream at Configfile to pick-up parameters of detector (Position,...) // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(string Path) ; + void ReadConfiguration(string Path); // Construct detector and inialise sensitive part. // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; + void ConstructDetector(G4LogicalVolume* world); // Add Detector branch to the EventTree. // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; + void InitializeRootOutput(); // Read sensitive part and fill the Root tree. // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; + void ReadSensitive(const G4Event* event); //////////////////////////////////////////////////// ///////////Event class to store Data//////////////// //////////////////////////////////////////////////// private: - TMust2Data* m_Event ; + TMust2Data* m_Event; //////////////////////////////////////////////////// ///////////////Private intern Data////////////////// @@ -150,8 +150,8 @@ private: vector<G4ThreeVector> m_X128_Y128 ; // Center Corner Position Vector // Used for "By Angle Definition" - vector<G4double> m_R ; // | - vector<G4double> m_Theta ; // > Spherical coordinate of Strips Silicium Plate + vector<G4double> m_R ; // | + vector<G4double> m_Theta ; // > Spherical coordinate of Strips Silicium Plate vector<G4double> m_Phi ; // | vector<G4double> m_beta_u ; // | @@ -160,52 +160,52 @@ private: // If Set to true if you want this stage on you telescope vector<bool> m_wSi ; // Silicium Strip 300um 128*128 Strip - vector<bool> m_wSiLi ; // Si(Li) 2*4 Pad - vector<bool> m_wCsI ; // CsI 4*4 crystal + vector<bool> m_wSiLi ; // Si(Li) 2*4 Pad + vector<bool> m_wCsI ; // CsI 4*4 crystal vector<bool> m_wAddSi ; // Additionnal Thin Silicium Strip // Set to true if you want to see Telescope Frame in your visualisation - bool m_non_sensitive_part_visiualisation ; + bool m_non_sensitive_part_visiualisation ; - //////////////////////////////////////////////////// - ///////////////////// Scorer /////////////////////// - //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + ///////////////////// Scorer /////////////////////// + //////////////////////////////////////////////////// private: - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Silicon Associate Scorer - G4MultiFunctionalDetector* m_StripScorer ; - - - // SiLi Associate Scorer - G4MultiFunctionalDetector* m_SiLiScorer ; + // Initialize all Scorer used by the MUST2Array + void InitializeScorers() ; + + // Silicon Associate Scorer + G4MultiFunctionalDetector* m_StripScorer ; + + + // SiLi Associate Scorer + G4MultiFunctionalDetector* m_SiLiScorer ; - // CsI Associate Scorer - G4MultiFunctionalDetector* m_CsIScorer ; + // CsI Associate Scorer + G4MultiFunctionalDetector* m_CsIScorer ; - //////////////////////////////////////////////////// - //////////////////// Material ////////////////////// - //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + //////////////////// Material ////////////////////// + //////////////////////////////////////////////////// private: - // Declare all material used by the MUST2Array - void InitializeMaterial() ; - // Si - G4Material* m_MaterialSilicon; - // Al - G4Material* m_MaterialAluminium; - // Iron - G4Material* m_MaterialIron; - // CsI - G4Material* m_MaterialCsI; - // Vacuum - G4Material* m_MaterialVacuum ; - // Mylar - G4Material* m_MaterialMyl; - // Havar - G4Material* m_MaterialHarvar; + // Declare all material used by the MUST2Array + void InitializeMaterial() ; + // Si + G4Material* m_MaterialSilicon; + // Al + G4Material* m_MaterialAluminium; + // Iron + G4Material* m_MaterialIron; + // CsI + G4Material* m_MaterialCsI; + // Vacuum + G4Material* m_MaterialVacuum ; + // Mylar + G4Material* m_MaterialMyl; + // Havar + G4Material* m_MaterialHarvar; diff --git a/NPSimulation/include/Must2Scorers.hh b/NPSimulation/include/Must2Scorers.hh index 2eb5431d8..a5e1ebea6 100644 --- a/NPSimulation/include/Must2Scorers.hh +++ b/NPSimulation/include/Must2Scorers.hh @@ -27,82 +27,82 @@ #include "G4VPrimitiveScorer.hh" #include "G4THitsMap.hh" namespace MUST2 { - - class PSStripNumberX : public G4VPrimitiveScorer - { - - public: // with description - PSStripNumberX(G4String name, G4int depth = 0, G4double StripPlaneSize = 98, G4int NumberOfStrip = 128); - virtual ~PSStripNumberX(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4double m_StripPlaneSize; - G4int m_NumberOfStrip ; - G4double m_StripPitch ; - G4int HCID; - G4THitsMap<G4int>* EvtMap; - }; - - - - class PSStripNumberY : public G4VPrimitiveScorer - { - - public: // with description - PSStripNumberY(G4String name, G4int depth = 0, G4double StripPlaneSize = 98, G4int NumberOfStrip = 128); - virtual ~PSStripNumberY(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4double m_StripPlaneSize; - G4int m_NumberOfStrip ; - G4double m_StripPitch ; - G4int HCID; - G4THitsMap<G4int>* EvtMap; - }; - - - class PSPadOrCristalNumber : public G4VPrimitiveScorer - { - - public: // with description - PSPadOrCristalNumber(G4String name, G4int depth = 0); - virtual ~PSPadOrCristalNumber(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4int HCID; - G4THitsMap<G4int>* EvtMap; - }; - + + class PSStripNumberX : public G4VPrimitiveScorer + { + + public: // with description + PSStripNumberX(G4String name, G4int depth = 0, G4double StripPlaneSize = 98, G4int NumberOfStrip = 128); + virtual ~PSStripNumberX(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4double m_StripPlaneSize; + G4int m_NumberOfStrip ; + G4double m_StripPitch; + G4int HCID; + G4THitsMap<G4int>* EvtMap; + }; + + + + class PSStripNumberY : public G4VPrimitiveScorer + { + + public: // with description + PSStripNumberY(G4String name, G4int depth = 0, G4double StripPlaneSize = 98, G4int NumberOfStrip = 128); + virtual ~PSStripNumberY(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4double m_StripPlaneSize; + G4int m_NumberOfStrip ; + G4double m_StripPitch; + G4int HCID; + G4THitsMap<G4int>* EvtMap; + }; + + + class PSPadOrCristalNumber : public G4VPrimitiveScorer + { + + public: // with description + PSPadOrCristalNumber(G4String name, G4int depth = 0); + virtual ~PSPadOrCristalNumber(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4int HCID; + G4THitsMap<G4int>* EvtMap; + }; + } #endif diff --git a/NPSimulation/include/ParisCluster.hh b/NPSimulation/include/ParisCluster.hh index 466506e67..da11f0636 100644 --- a/NPSimulation/include/ParisCluster.hh +++ b/NPSimulation/include/ParisCluster.hh @@ -95,7 +95,7 @@ public: // deriving from ParisModule // This is mandatory since the Paris*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// @@ -133,10 +133,10 @@ private: namespace PARISCLUSTER { // Resolution -// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoFirstStage = 0.0085; // = 3% at .662 MeV of Resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.0366; // = 13% at .662 MeV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0.0; // = 50 keV of resolution // Unit is MeV/2.35 +// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 + const G4double ResoFirstStage = 0.0085; // = 3% at .662 MeV of Resolution // Unit is MeV/2.35 + const G4double ResoSecondStage = 0.0366; // = 13% at .662 MeV of resolution // Unit is MeV/2.35 + const G4double ResoThirdStage = 0.0; // = 50 keV of resolution // Unit is MeV/2.35 const G4double ResoTimeGpd = 0.212765957;// = 500ps // Unit is ns/2.35 // Geometry for the mother volume containing the different layers of your dummy shape module diff --git a/NPSimulation/include/ParisModule.hh b/NPSimulation/include/ParisModule.hh index d63fdc58a..bdaca9670 100644 --- a/NPSimulation/include/ParisModule.hh +++ b/NPSimulation/include/ParisModule.hh @@ -71,11 +71,11 @@ public: void InitializeIndex(); public: - TParisData* GetEventPointer() {return ms_Event;}; + TParisData* GetEventPointer() {return ms_Event;}; protected: // Class to store the result of simulation - static TParisData* ms_Event; + static TParisData* ms_Event; // Set to true if you want to see Telescope Frame in your visualisation bool m_non_sensitive_part_visiualisation; diff --git a/NPSimulation/include/ParisPhoswich.hh b/NPSimulation/include/ParisPhoswich.hh index a7f7669be..650fff8c1 100644 --- a/NPSimulation/include/ParisPhoswich.hh +++ b/NPSimulation/include/ParisPhoswich.hh @@ -95,7 +95,7 @@ public: // deriving from ParisModule // This is mandatory since the Paris*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// @@ -138,10 +138,10 @@ namespace PARISPHOSWICH // Resolution -// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoFirstStage = 0.0099; // = 3.5% at .662MeV of Resolution // Unit is MeV/2.35 - const G4double ResoSecondStage = 0.0366; // = 13% at .662 MeV of resolution // Unit is MeV/2.35 - const G4double ResoThirdStage = 0.0213; // = 50 keV of resolution // Unit is MeV/2.35 +// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 + const G4double ResoFirstStage = 0.0099; // = 3.5% at .662MeV of Resolution // Unit is MeV/2.35 + const G4double ResoSecondStage = 0.0366; // = 13% at .662 MeV of resolution // Unit is MeV/2.35 + const G4double ResoThirdStage = 0.0213; // = 50 keV of resolution // Unit is MeV/2.35 const G4double ResoTimeGpd = 0.212765957;// = 500ps // Unit is ns/2.35 // Geometry for the mother volume containing the different layers of your dummy shape module diff --git a/NPSimulation/include/Plastic.hh b/NPSimulation/include/Plastic.hh index 02f2020db..85ec1739c 100644 --- a/NPSimulation/include/Plastic.hh +++ b/NPSimulation/include/Plastic.hh @@ -15,7 +15,7 @@ *---------------------------------------------------------------------------* * Decription: * * This class describe a Modular cylindrical Plastic Scintillator * - * Few Material are instantiate and user can choose position and dimension * + * Few Material are instantiate and user can choose position and dimension * * but also the adding of a lead plate on the rear side of the detector * * * *---------------------------------------------------------------------------* @@ -55,61 +55,61 @@ public: //////////////////////////////////////////////////// public: // Cylindric plastic - void AddPlastic( G4double R , - G4double Theta , - G4double Phi , - G4double PlasticThickness , - G4double PlasticRadius , - G4String Scintillator , - G4double LeadThickness ); + void AddPlastic( G4double R , + G4double Theta , + G4double Phi , + G4double PlasticThickness , + G4double PlasticRadius , + G4String Scintillator , + G4double LeadThickness ); // Squared Plastic - void AddPlastic( G4double R , - G4double Theta , - G4double Phi , - G4double Height , - G4double Width , - G4double Thickness , - G4String Scintillator , - G4double LeadThickness ); - - void VolumeMaker(G4ThreeVector Det_pos, int DetNumber,G4LogicalVolume* world) ; + void AddPlastic( G4double R , + G4double Theta , + G4double Phi , + G4double Height , + G4double Width , + G4double Thickness , + G4String Scintillator , + G4double LeadThickness ); + + void VolumeMaker(G4ThreeVector Det_pos, int DetNumber,G4LogicalVolume* world) ; //////////////////////////////////////////////////// ///////// Inherite from VDetector class /////////// //////////////////////////////////////////////////// public: // Read stream at Configfile to pick-up parameters of detector (Position,...) // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(string Path) ; + void ReadConfiguration(string Path) ; // Construct detector and inialise sensitive part. // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; + void ConstructDetector(G4LogicalVolume* world) ; // Add Detector branch to the EventTree. // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; + void InitializeRootOutput() ; // Read sensitive part and fill the Root tree. // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; + void ReadSensitive(const G4Event* event) ; public: // Material - void InitializeMaterial() ; - // Platic - G4Material* m_MaterialPlastic_BC400 ; //BC-400 type plastic - G4Material* m_MaterialPlastic_BC452_2 ; //BC452:BC-400 loaded with 2%Pb type plastic - G4Material* m_MaterialPlastic_BC452_5 ; //BC452:BC-400 loaded with 5%Pb type plastic - G4Material* m_MaterialPlastic_BC452_10 ; //BC452:BC-400 loaded with 10%Pb type plastic - // Lead - G4Material* m_MaterialLead ; - -public: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Silicon Associate Scorer - G4MultiFunctionalDetector* m_PlasticScorer ; + void InitializeMaterial() ; + // Platic + G4Material* m_MaterialPlastic_BC400 ; //BC-400 type plastic + G4Material* m_MaterialPlastic_BC452_2 ; //BC452:BC-400 loaded with 2%Pb type plastic + G4Material* m_MaterialPlastic_BC452_5 ; //BC452:BC-400 loaded with 5%Pb type plastic + G4Material* m_MaterialPlastic_BC452_10 ; //BC452:BC-400 loaded with 10%Pb type plastic + // Lead + G4Material* m_MaterialLead ; + +public: // Scorer + // Initialize all Scorer used by the MUST2Array + void InitializeScorers() ; + + // Silicon Associate Scorer + G4MultiFunctionalDetector* m_PlasticScorer ; //////////////////////////////////////////////////// ///////////Event class to store Data//////////////// //////////////////////////////////////////////////// @@ -124,20 +124,20 @@ private: // Lead plate is added in front or back of the detector - vector<double> m_LeadThickness ; + vector<double> m_LeadThickness ; - vector<double> m_PlasticThickness ; - vector<double> m_PlasticRadius ; // cylindrical shape - vector<double> m_PlasticHeight ; // squared shape - vector<double> m_PlasticWidth ; // squared shape - + vector<double> m_PlasticThickness ; + vector<double> m_PlasticRadius ; // cylindrical shape + vector<double> m_PlasticHeight ; // squared shape + vector<double> m_PlasticWidth ; // squared shape + // Used for "By Angle Definition" - vector<G4double> m_R ; // | - vector<G4double> m_Theta ; // > Spherical coordinate plastic volume center - vector<G4double> m_Phi ; // | + vector<G4double> m_R ; // | + vector<G4double> m_Theta ; // > Spherical coordinate plastic volume center + vector<G4double> m_Phi ; // | - // Scintillator type - vector<G4String> m_Scintillator ; + // Scintillator type + vector<G4String> m_Scintillator ; }; diff --git a/NPSimulation/include/PrimaryGeneratorAction.hh b/NPSimulation/include/PrimaryGeneratorAction.hh index 9638cea6a..dfc2cce7e 100644 --- a/NPSimulation/include/PrimaryGeneratorAction.hh +++ b/NPSimulation/include/PrimaryGeneratorAction.hh @@ -46,15 +46,15 @@ public: public: void GeneratePrimaries(G4Event*); - G4ParticleGun* GetParticleGun() {return m_particleGun;} + G4ParticleGun* GetParticleGun() {return m_particleGun;} public: void ReadEventGeneratorFile(string Path); private: - G4ParticleGun* m_particleGun; - DetectorConstruction* m_detector; - VEventGenerator* m_EventGenerator; + G4ParticleGun* m_particleGun; + DetectorConstruction* m_detector; + VEventGenerator* m_EventGenerator; }; #endif diff --git a/NPSimulation/include/ShieldClParis.hh b/NPSimulation/include/ShieldClParis.hh index cc106b521..c0d489dcf 100644 --- a/NPSimulation/include/ShieldClParis.hh +++ b/NPSimulation/include/ShieldClParis.hh @@ -97,7 +97,7 @@ public: // deriving from ParisModule // This is mandatory since the Paris*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// @@ -135,8 +135,8 @@ private: namespace PARISCLSHIELD { // Resolution -// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoFirstStage = 0.0366; // = 13% at .662 MeV of Resolution // Unit is MeV/2.35 +// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 + const G4double ResoFirstStage = 0.0366; // = 13% at .662 MeV of Resolution // Unit is MeV/2.35 const G4double ResoTimeGpd = 0.212765957;// = 500ps // Unit is ns/2.35 // Geometry for the mother volume containing the different layers of your dummy shape module diff --git a/NPSimulation/include/ShieldModule.hh b/NPSimulation/include/ShieldModule.hh index 6027baca2..cd0ff65d8 100644 --- a/NPSimulation/include/ShieldModule.hh +++ b/NPSimulation/include/ShieldModule.hh @@ -71,11 +71,11 @@ public: void InitializeIndex(); public: - TShieldData* GetEventPointer() {return ms_Event;}; + TShieldData* GetEventPointer() {return ms_Event;}; protected: // Class to store the result of simulation - static TShieldData* ms_Event; + static TShieldData* ms_Event; // Set to true if you want to see Telescope Frame in your visualisation bool m_non_sensitive_part_visiualisation; diff --git a/NPSimulation/include/ShieldPhParis.hh b/NPSimulation/include/ShieldPhParis.hh index 36ba8e5a2..3dc7e800a 100644 --- a/NPSimulation/include/ShieldPhParis.hh +++ b/NPSimulation/include/ShieldPhParis.hh @@ -96,7 +96,7 @@ public: // deriving from ParisModule // This is mandatory since the Paris*** does not derive from VDetector void SetInterCoordPointer(TInteractionCoordinates* interCoord); - TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; + TInteractionCoordinates* GetInterCoordPointer() {return ms_InterCoord;}; //////////////////////////////////////////////////// @@ -133,8 +133,8 @@ private: namespace PARISPHSHIELD { // Resolution -// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 - const G4double ResoFirstStage = 0.0366; // = 3% at .662 MeV of Resolution // Unit is MeV/2.35 +// const G4double ResoFirstStage = 0; // = 50 keV of Resolution // Unit is MeV/2.35 + const G4double ResoFirstStage = 0.0366; // = 3% at .662 MeV of Resolution // Unit is MeV/2.35 const G4double ResoTimeGpd = 0.212765957;// = 500ps // Unit is ns/2.35 // Geometry for the mother volume containing the different layers of your dummy shape module diff --git a/NPSimulation/include/Target.hh b/NPSimulation/include/Target.hh index 285b175e2..19f38b357 100644 --- a/NPSimulation/include/Target.hh +++ b/NPSimulation/include/Target.hh @@ -45,87 +45,87 @@ using namespace std; class Target : public VDetector { - public: - Target(); - ~Target(){}; - - - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(string Path); - - // 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: - // method for debug purpose (still to be implemented) - // This method should check if the results of the beam interaction within the target - // (interaction coordinates) are well located inside the target volume - bool IsInsideTarget() {return false;}; - - // Used to calculate the incident beam direction (taking into account - // the emittance) and the vertex of interaction in target - // Also compute the energy lost by the beam in the target before interacting - void CalculateBeamInteraction(double MeanPosX, double SigmaPosX, double MeanPosTheta, double SigmaPosTheta, - double MeanPosY, double SigmaPosY, double MeanPosPhi, double SigmaPosPhi, - double IncidentBeamEnergy, - G4ParticleDefinition* BeamName, - G4ThreeVector &InterCoord, double &AngleEmittanceTheta, double &AngleEmittancePhi, - double &AngleIncidentTheta, double &AngleIncidentPhi, - double &FinalBeamEnergy); - - // Used to simulate beam emmitance effect - void RandomGaussian2D(double MeanX, double MeanY, double SigmaX, double SigmaY, double &X, double &Y, double NumberOfSigma = 10000); - - public: - // Return Material from the Target Material Library - G4Material* GetMaterialFromLibrary(G4String MaterialName, G4double Temperature = 0, G4double Pressure = 0); - - // Generate a DEDX file table using the material used in the target - void WriteDEDXTable(G4ParticleDefinition* Particle,G4double Emin,G4double Emax); - - public: - G4double GetTargetThickness() {return m_TargetThickness;} - G4Material* GetTargetMaterial() {return m_TargetMaterial;} - G4double GetTargetRadius() {return m_TargetRadius;} - G4double GetTargetAngle() {return m_TargetAngle;} - G4double GetTargetX() {return m_TargetX;} - G4double GetTargetY() {return m_TargetY;} - G4double GetTargetZ() {return m_TargetZ;} - G4int GetTargetNbLayers() {return m_TargetNbLayers;} - - - private: - // Target type : true = normal ; false = cryo - bool m_TargetType; - - // Standard parameter - G4double m_TargetThickness; - G4double m_TargetRadius; - G4double m_TargetAngle; - G4Material* m_TargetMaterial; - G4int m_TargetNbLayers; - - // For Cryo Target - G4double m_TargetTemperature; - G4double m_TargetPressure; - G4double m_WindowsThickness; - G4Material* m_WindowsMaterial; - - // Positioning - G4double m_TargetX; - G4double m_TargetY; - G4double m_TargetZ; + public: + Target(); + ~Target(){}; + + + public: + // Read stream at Configfile to pick-up parameters of detector (Position,...) + // Called in DetecorConstruction::ReadDetextorConfiguration Method + void ReadConfiguration(string Path); + + // 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: + // method for debug purpose (still to be implemented) + // This method should check if the results of the beam interaction within the target + // (interaction coordinates) are well located inside the target volume + bool IsInsideTarget() {return false;}; + + // Used to calculate the incident beam direction (taking into account + // the emittance) and the vertex of interaction in target + // Also compute the energy lost by the beam in the target before interacting + void CalculateBeamInteraction(double MeanPosX, double SigmaPosX, double MeanPosTheta, double SigmaPosTheta, + double MeanPosY, double SigmaPosY, double MeanPosPhi, double SigmaPosPhi, + double IncidentBeamEnergy, + G4ParticleDefinition* BeamName, + G4ThreeVector &InterCoord, double &AngleEmittanceTheta, double &AngleEmittancePhi, + double &AngleIncidentTheta, double &AngleIncidentPhi, + double &FinalBeamEnergy); + + // Used to simulate beam emmitance effect + void RandomGaussian2D(double MeanX, double MeanY, double SigmaX, double SigmaY, double &X, double &Y, double NumberOfSigma = 10000); + + public: + // Return Material from the Target Material Library + G4Material* GetMaterialFromLibrary(G4String MaterialName, G4double Temperature = 0, G4double Pressure = 0); + + // Generate a DEDX file table using the material used in the target + void WriteDEDXTable(G4ParticleDefinition* Particle,G4double Emin,G4double Emax); + + public: + G4double GetTargetThickness() {return m_TargetThickness;} + G4Material* GetTargetMaterial() {return m_TargetMaterial;} + G4double GetTargetRadius() {return m_TargetRadius;} + G4double GetTargetAngle() {return m_TargetAngle;} + G4double GetTargetX() {return m_TargetX;} + G4double GetTargetY() {return m_TargetY;} + G4double GetTargetZ() {return m_TargetZ;} + G4int GetTargetNbLayers() {return m_TargetNbLayers;} + + + private: + // Target type : true = normal ; false = cryo + bool m_TargetType; + + // Standard parameter + G4double m_TargetThickness; + G4double m_TargetRadius; + G4double m_TargetAngle; + G4Material* m_TargetMaterial; + G4int m_TargetNbLayers; + + // For Cryo Target + G4double m_TargetTemperature; + G4double m_TargetPressure; + G4double m_WindowsThickness; + G4Material* m_WindowsMaterial; + + // Positioning + G4double m_TargetX; + G4double m_TargetY; + G4double m_TargetZ; }; #endif diff --git a/NPSimulation/include/ThinSi.hh b/NPSimulation/include/ThinSi.hh index 562c0d4d7..7d96c6020 100644 --- a/NPSimulation/include/ThinSi.hh +++ b/NPSimulation/include/ThinSi.hh @@ -47,16 +47,16 @@ namespace THINSI const G4double ResoEnergy = 0.064 ;// = 150keV of Resolution // Unit is MeV/2.35 // Geometry - const G4double DetectorSize = 68*mm ; + const G4double DetectorSize = 68*mm ; const G4double SiliconThickness = 20*micrometer ; const G4double FrameThickness = 3*mm ; - const G4double SiliconSize = 50*mm ; + const G4double SiliconSize = 50*mm ; const G4double AluThickness = 0.4*micrometer ; - const G4int NumberOfStrip = 16 ; + const G4int NumberOfStrip = 16 ; - const G4double AluStripFront_PosZ = -0.5*SiliconThickness - 0.5*AluThickness ; - const G4double Si_PosZ = 0 ; - const G4double AluStripBack_PosZ = 0.5*SiliconThickness + 0.5*AluThickness ; + const G4double AluStripFront_PosZ = -0.5*SiliconThickness - 0.5*AluThickness ; + const G4double Si_PosZ = 0 ; + const G4double AluStripBack_PosZ = 0.5*SiliconThickness + 0.5*AluThickness ; } @@ -76,24 +76,24 @@ public: //////////////////////////////////////////////////// public: // By Position Method - void AddTelescope(G4ThreeVector TL , - G4ThreeVector BL , - G4ThreeVector BR , - G4ThreeVector TR ); + void AddTelescope( G4ThreeVector TL , + G4ThreeVector BL , + G4ThreeVector BR , + G4ThreeVector TR ); // By Angle Method - void AddTelescope(G4double R , - G4double Theta , - G4double Phi , - G4double beta_u , - G4double beta_v , - G4double beta_w ); + void AddTelescope( G4double R , + G4double Theta , + G4double Phi , + G4double beta_u , + G4double beta_v , + G4double beta_w ); // Effectively construct Volume // Avoid to have two time same code for Angle and Point definition - void VolumeMaker(G4int DetectorNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - G4LogicalVolume* world ); + void VolumeMaker( G4int DetectorNumber , + G4ThreeVector MMpos , + G4RotationMatrix* MMrot , + G4LogicalVolume* world ); //////////////////////////////////////////////////// @@ -102,19 +102,19 @@ public: public: // Read stream at Configfile to pick-up parameters of detector (Position,...) // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(string Path) ; + void ReadConfiguration(string Path) ; // Construct detector and inialise sensitive part. // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; + void ConstructDetector(G4LogicalVolume* world) ; // Add Detector branch to the EventTree. // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; + void InitializeRootOutput() ; // Read sensitive part and fill the Root tree. // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; + void ReadSensitive(const G4Event* event) ; //////////////////////////////////////////////////// @@ -123,27 +123,27 @@ public: private: TSSSDData* m_Event ; - //////////////////////////////////////////////////// + //////////////////////////////////////////////////// ///////////////// Scorer Related /////////////////// //////////////////////////////////////////////////// private: - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Scorer Associate to the 20um Silicon stage - G4MultiFunctionalDetector* m_StripScorer ; + // Initialize all Scorer used by the MUST2Array + void InitializeScorers() ; + + // Scorer Associate to the 20um Silicon stage + G4MultiFunctionalDetector* m_StripScorer ; private: - // Initialize mmaterial used in detector definition - void InitializeMaterial(); + // Initialize mmaterial used in detector definition + void InitializeMaterial(); - // List of material - G4Material* m_MaterialSilicon ; - G4Material* m_MaterialAl ; - G4Material* m_MaterialVacuum ; + // List of material + G4Material* m_MaterialSilicon ; + G4Material* m_MaterialAl ; + G4Material* m_MaterialVacuum ; //////////////////////////////////////////////////// ///////////////Private intern Data////////////////// @@ -159,15 +159,15 @@ private: vector<G4ThreeVector> m_TR ; // Center Corner Position Vector // Used for "By Angle Definition" - vector<G4double> m_R ; // | - vector<G4double> m_Theta ; // > Spherical coordinate of Strips Silicium Plate + vector<G4double> m_R ; // | + vector<G4double> m_Theta ; // > Spherical coordinate of Strips Silicium Plate vector<G4double> m_Phi ; // | vector<G4double> m_beta_u ; // | vector<G4double> m_beta_v ; // >Tilt angle of the Telescope vector<G4double> m_beta_w ; // | // Set to true if you want to see Telescope Frame in your visualisation - bool m_non_sensitive_part_visiualisation ; + bool m_non_sensitive_part_visiualisation ; }; #endif diff --git a/NPSimulation/include/ThinSiScorers.hh b/NPSimulation/include/ThinSiScorers.hh index a2dc8630b..fb2b72c5d 100644 --- a/NPSimulation/include/ThinSiScorers.hh +++ b/NPSimulation/include/ThinSiScorers.hh @@ -28,31 +28,31 @@ #include "G4THitsMap.hh" namespace THINSI { - - class PSStripNumber : public G4VPrimitiveScorer - { - - public: // with description - PSStripNumber(G4String name, G4int depth = 0, G4double StripPlaneSize = 50*mm, G4int NumberOfStrip = 16); - virtual ~PSStripNumber(); - - protected: // with description - virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); - - public: - virtual void Initialize(G4HCofThisEvent*); - virtual void EndOfEvent(G4HCofThisEvent*); - virtual void clear(); - virtual void DrawAll(); - virtual void PrintAll(); - - private: - G4double m_StripPlaneSize; - G4int m_NumberOfStrip ; - G4double m_StripPitch ; - G4int HCID; - G4THitsMap<G4int>* EvtMap; - }; + + class PSStripNumber : public G4VPrimitiveScorer + { + + public: // with description + PSStripNumber(G4String name, G4int depth = 0, G4double StripPlaneSize = 50*mm, G4int NumberOfStrip = 16); + virtual ~PSStripNumber(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4double m_StripPlaneSize; + G4int m_NumberOfStrip ; + G4double m_StripPitch ; + G4int HCID; + G4THitsMap<G4int>* EvtMap; + }; } diff --git a/NPSimulation/include/VDetector.hh b/NPSimulation/include/VDetector.hh index 4b05066eb..c5a5a12f0 100644 --- a/NPSimulation/include/VDetector.hh +++ b/NPSimulation/include/VDetector.hh @@ -22,17 +22,17 @@ * * *---------------------------------------------------------------------------* * Comment: * - * Detector inheriting from VDetector should follow this Naming convention * + * Detector inheriting from VDetector should follow this Naming convention * * for logical volume: * - * DetectorNameX_SubPart * - * * - * -DetectorName is the name of the detector, like "MUST2Array", * - * note that use of _ within the name is prohibitted. * + * DetectorNameX_SubPart * * * - * -X is the detector Number, for example if you have two plastic then you* - * will have Plastic1 and Plastic2 * + * -DetectorName is the name of the detector, like "MUST2Array", * + * note that use of _ within the name is prohibitted. * * * - * -SubPart is the optionnal sub part, like for examples Si and CsI in * + * -X is the detector Number, for example if you have two plastic then you* + * will have Plastic1 and Plastic2 * + * * + * -SubPart is the optionnal sub part, like for examples Si and CsI in * * MUST2. Note that you can add as many as _SubPart you need * * * *****************************************************************************/ diff --git a/NPSimulation/src/AnnularS1.cc b/NPSimulation/src/AnnularS1.cc index 9c904669d..40bf715b3 100644 --- a/NPSimulation/src/AnnularS1.cc +++ b/NPSimulation/src/AnnularS1.cc @@ -269,22 +269,22 @@ void AnnularS1::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' ); } // Position method else if (DataBuffer.compare(0, 2, "Z=") == 0) { - check_Z = true; - ConfigFile >> DataBuffer ; - Z = atof(DataBuffer.c_str()) ; - Z = Z * mm; - cout << "Z: " << Z / mm << endl; - } + check_Z = true; + ConfigFile >> DataBuffer ; + Z = atof(DataBuffer.c_str()) ; + Z = Z * mm; + cout << "Z: " << Z / mm << endl; + } else if (DataBuffer.compare(0, 4, "VIS=") == 0) { check_VIS = true; - ConfigFile >> DataBuffer; - if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; + ConfigFile >> DataBuffer; + if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } else { /////////////////////////////////////////////////// diff --git a/NPSimulation/src/Chamber.cc b/NPSimulation/src/Chamber.cc index 2d897e630..e0a61bb1d 100644 --- a/NPSimulation/src/Chamber.cc +++ b/NPSimulation/src/Chamber.cc @@ -52,13 +52,13 @@ using namespace std; // Specific Method of this class Chamber::Chamber() { - m_ChamberType = true; - m_ChamberRmin = 0 ; - m_ChamberRmax = 0 ; - m_ChamberPhiMin = 0 ; - m_ChamberPhiMax = 0 ; - m_ChamberThetaMin = 0 ; - m_ChamberThetaMax = 0 ; + m_ChamberType = true; + m_ChamberRmin = 0 ; + m_ChamberRmax = 0 ; + m_ChamberPhiMin = 0 ; + m_ChamberPhiMax = 0 ; + m_ChamberThetaMin = 0 ; + m_ChamberThetaMax = 0 ; } G4Material* Chamber::GetMaterialFromLibrary(G4String MaterialName, G4double Temperature, G4double Pressure) @@ -112,7 +112,7 @@ void Chamber::ReadConfiguration(string Path) ConfigFile.open(Path.c_str()); string LineBuffer; string DataBuffer; - + bool ReadingStatusChamber = false ; // bool ReadingStatusCryoChamber = false ; @@ -124,7 +124,7 @@ void Chamber::ReadConfiguration(string Path) bool check_ThetaMax = false ; bool check_Material = false ; - + while (!ConfigFile.eof()) { getline(ConfigFile, LineBuffer); if (LineBuffer.compare(0, 8, "Chamber") == 0) { @@ -142,70 +142,70 @@ void Chamber::ReadConfiguration(string Path) while (ReadingStatusChamber) { ConfigFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - else if (DataBuffer.compare(0, 5, "Rmin=") == 0) { - check_Rmin = true ; - ConfigFile >> DataBuffer; - m_ChamberRmin = atof(DataBuffer.c_str()) * mm; - cout << "Chamber inner radius: " << m_ChamberRmin << endl ; - } - - else if (DataBuffer.compare(0, 5, "Rmax=") == 0) { - check_Rmax = true ; - ConfigFile >> DataBuffer; - m_ChamberRmax = atof(DataBuffer.c_str()) * mm; - cout << "Chamber outer radius: " << m_ChamberRmax << endl ; - } - - else if (DataBuffer.compare(0, 8, "PhiMin=") == 0) { - check_PhiMin = true ; - ConfigFile >> DataBuffer; - m_ChamberPhiMin = atof(DataBuffer.c_str()) * rad; - cout << "Chamber PhiMin: " << m_ChamberPhiMin << endl ; - } - else if (DataBuffer.compare(0, 8, "PhiMax=") == 0) { - check_PhiMax = true ; - ConfigFile >> DataBuffer; - m_ChamberPhiMax = atof(DataBuffer.c_str()) * rad; - cout << "Chamber PhiMax: " << m_ChamberPhiMax << endl ; - } - else if (DataBuffer.compare(0, 9, "ThetaMin=") == 0) { - check_ThetaMin = true ; - ConfigFile >> DataBuffer; - m_ChamberThetaMin = atof(DataBuffer.c_str()) * rad; - cout << "Chamber ThetaMin: " << m_ChamberThetaMin << endl ; - } - else if (DataBuffer.compare(0, 9, "ThetaMax=") == 0) { - check_ThetaMax = true ; - ConfigFile >> DataBuffer; - m_ChamberThetaMax = atof(DataBuffer.c_str()) * rad; - cout << "Chamber ThetaMax: " << m_ChamberThetaMax << endl ; - } - - else if (DataBuffer.compare(0, 9, "MATERIAL=") == 0) { - check_Material = true ; - ConfigFile >> DataBuffer; - m_ChamberMaterial = GetMaterialFromLibrary(DataBuffer); - cout << "Chamber Material: " << m_ChamberMaterial << endl ; - } - - /////////////////////////////////////////////////// - // If no Beam Token and no comment, toggle out - else - {ReadingStatusChamber = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if( check_Rmin && check_Rmax && check_Material && check_PhiMin && check_PhiMax && check_ThetaMin && check_ThetaMax ) - ReadingStatusChamber = false ; - - } + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + else if (DataBuffer.compare(0, 5, "Rmin=") == 0) { + check_Rmin = true ; + ConfigFile >> DataBuffer; + m_ChamberRmin = atof(DataBuffer.c_str()) * mm; + cout << "Chamber inner radius: " << m_ChamberRmin << endl ; + } + + else if (DataBuffer.compare(0, 5, "Rmax=") == 0) { + check_Rmax = true ; + ConfigFile >> DataBuffer; + m_ChamberRmax = atof(DataBuffer.c_str()) * mm; + cout << "Chamber outer radius: " << m_ChamberRmax << endl ; + } + + else if (DataBuffer.compare(0, 8, "PhiMin=") == 0) { + check_PhiMin = true ; + ConfigFile >> DataBuffer; + m_ChamberPhiMin = atof(DataBuffer.c_str()) * rad; + cout << "Chamber PhiMin: " << m_ChamberPhiMin << endl ; + } + else if (DataBuffer.compare(0, 8, "PhiMax=") == 0) { + check_PhiMax = true ; + ConfigFile >> DataBuffer; + m_ChamberPhiMax = atof(DataBuffer.c_str()) * rad; + cout << "Chamber PhiMax: " << m_ChamberPhiMax << endl ; + } + else if (DataBuffer.compare(0, 9, "ThetaMin=") == 0) { + check_ThetaMin = true ; + ConfigFile >> DataBuffer; + m_ChamberThetaMin = atof(DataBuffer.c_str()) * rad; + cout << "Chamber ThetaMin: " << m_ChamberThetaMin << endl ; + } + else if (DataBuffer.compare(0, 9, "ThetaMax=") == 0) { + check_ThetaMax = true ; + ConfigFile >> DataBuffer; + m_ChamberThetaMax = atof(DataBuffer.c_str()) * rad; + cout << "Chamber ThetaMax: " << m_ChamberThetaMax << endl ; + } + + else if (DataBuffer.compare(0, 9, "MATERIAL=") == 0) { + check_Material = true ; + ConfigFile >> DataBuffer; + m_ChamberMaterial = GetMaterialFromLibrary(DataBuffer); + cout << "Chamber Material: " << m_ChamberMaterial << endl ; + } + + /////////////////////////////////////////////////// + // If no Beam Token and no comment, toggle out + else + {ReadingStatusChamber = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if( check_Rmin && check_Rmax && check_Material && check_PhiMin && check_PhiMax && check_ThetaMin && check_ThetaMax ) + ReadingStatusChamber = false ; + + } - + } @@ -220,12 +220,12 @@ void Chamber::ConstructDetector(G4LogicalVolume* world) // If don't you will have a Warning unused variable 'myPVP' G4VPhysicalVolume* PVPBuffer ; - if (m_ChamberType) { // case of standard Chamber + if (m_ChamberType) { // case of standard Chamber - G4Sphere* solidChamber - = new G4Sphere("solidChamber", m_ChamberRmin, m_ChamberRmax, m_ChamberPhiMin, m_ChamberPhiMax, m_ChamberThetaMin, m_ChamberThetaMax ); + G4Sphere* solidChamber + = new G4Sphere("solidChamber", m_ChamberRmin, m_ChamberRmax, m_ChamberPhiMin, m_ChamberPhiMax, m_ChamberThetaMin, m_ChamberThetaMax ); - G4LogicalVolume* logicChamber = new G4LogicalVolume(solidChamber, m_ChamberMaterial, "logicChamber"); + G4LogicalVolume* logicChamber = new G4LogicalVolume(solidChamber, m_ChamberMaterial, "logicChamber"); // rotation of target //G4RotationMatrix *rotation = new G4RotationMatrix(); @@ -236,10 +236,10 @@ void Chamber::ConstructDetector(G4LogicalVolume* world) G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(0., 1., 1.)); logicChamber->SetVisAttributes(ChamberVisAtt); - // } + // } } - else { // case of cryogenic target + else { // case of cryogenic target } } @@ -253,4 +253,4 @@ void Chamber::InitializeRootOutput() // Called at in the EventAction::EndOfEventAvtion void Chamber::ReadSensitive(const G4Event*) {} - + diff --git a/NPSimulation/src/DetectorConstruction.cc b/NPSimulation/src/DetectorConstruction.cc index cd892fa83..031fe2d8d 100644 --- a/NPSimulation/src/DetectorConstruction.cc +++ b/NPSimulation/src/DetectorConstruction.cc @@ -61,8 +61,8 @@ DetectorConstruction::DetectorConstruction() : world_log(0), world_phys(0) { - m_Target = 0; - m_Chamber = 0; + m_Target = 0; + m_Chamber = 0; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -163,13 +163,13 @@ void DetectorConstruction::ReadConfigurationFile(string Path) bool cAddThinSi = false; bool cGeneralTarget = false; bool cGeneralChamber = false; - bool cGPDTracker = false; // Gaspard Tracker + bool cGPDTracker = false; // Gaspard Tracker bool cHYDTracker = false; // Hyde detector bool cS1 = false; bool cPlastic = false; bool cDummy = false; - bool cParis = false; // Paris Calorimeter - bool cShield = false; // Paris Shield CsI + bool cParis = false; // Paris Calorimeter + bool cShield = false; // Paris Shield CsI bool cW1 = false; // W1 Micron DSSD ////////////////////////////////////////////////////////////////////////////////////////// ifstream ConfigFile; @@ -363,7 +363,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) } //////////////////////////////////////////// - ////////// Search for Plastic /////////// + ////////// Search for Plastic /////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 19, "ScintillatorPlastic") == 0 && cPlastic == false) { cPlastic = true ; diff --git a/NPSimulation/src/DummyDetector.cc b/NPSimulation/src/DummyDetector.cc index bf79671be..ada0b0e2f 100644 --- a/NPSimulation/src/DummyDetector.cc +++ b/NPSimulation/src/DummyDetector.cc @@ -13,9 +13,9 @@ *---------------------------------------------------------------------------* * Decription: * * This class describe a simple Dummy Detector : * - * a simple cylinder of predifined material. user can choose to place it * + * a simple cylinder of predifined material. user can choose to place it * * where he want using spherical coordinate and choose between two naterial * - * * + * * * * *---------------------------------------------------------------------------* * Comment: * @@ -59,8 +59,8 @@ using namespace CLHEP; namespace DUMMYDETECTOR { // Energy and time Resolution - const G4double ResoTime = 4.2 ;// = 10ns of Resolution // Unit is MeV/2.35 - const G4double ResoEnergy = 5.0 ;// Resolution in % + const G4double ResoTime = 4.2 ;// = 10ns of Resolution // Unit is MeV/2.35 + const G4double ResoEnergy = 5.0 ;// Resolution in % } @@ -71,32 +71,32 @@ using namespace DUMMYDETECTOR ; // DUMMYDetector Specific Method DUMMYDetector::DUMMYDetector() { - InitializeMaterial(); - m_Event = new TDUMMYDetectorData() ; + InitializeMaterial(); + m_Event = new TDUMMYDetectorData() ; } DUMMYDetector::~DUMMYDetector() { - delete m_MaterialDUMMYDetector_material1 ; - delete m_MaterialDUMMYDetector_material2 ; - delete m_DUMMYDetectorScorer ; + delete m_MaterialDUMMYDetector_material1; + delete m_MaterialDUMMYDetector_material2; + delete m_DUMMYDetectorScorer; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void DUMMYDetector::AddDUMMYDetector( G4double R , - G4double Theta , - G4double Phi , - G4double DUMMYDetectorThickness , - G4double DUMMYDetectorRadius , - G4String Scintillator ) +void DUMMYDetector::AddDUMMYDetector( G4double R , + G4double Theta , + G4double Phi , + G4double DUMMYDetectorThickness , + G4double DUMMYDetectorRadius , + G4String Scintillator ) { - m_R.push_back(R) ; - m_Theta.push_back(Theta) ; - m_Phi.push_back(Phi) ; - m_DUMMYDetectorThickness.push_back(DUMMYDetectorThickness) ; - m_DUMMYDetectorRadius.push_back(DUMMYDetectorRadius) ; - m_Scintillator.push_back(Scintillator) ; + m_R.push_back(R); + m_Theta.push_back(Theta); + m_Phi.push_back(Phi); + m_DUMMYDetectorThickness.push_back(DUMMYDetectorThickness); + m_DUMMYDetectorRadius.push_back(DUMMYDetectorRadius); + m_Scintillator.push_back(Scintillator); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -109,134 +109,134 @@ void DUMMYDetector::AddDUMMYDetector( G4double R , // Called in DetecorConstruction::ReadDetextorConfiguration Method void DUMMYDetector::ReadConfiguration(string Path) { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; - - G4double Theta = 0 , Phi = 0 , R = 0 , Thickness = 0 , Radius = 0 ; - G4String Scintillator ; - - bool check_Theta = false ; - bool check_Phi = false ; - bool check_R = false ; - bool check_Thickness = false ; - bool check_Radius = false ;\ - bool check_Scintillator = false ; - bool ReadingStatus = false ; - + ifstream ConfigFile ; + ConfigFile.open(Path.c_str()) ; + string LineBuffer ; + string DataBuffer ; + + G4double Theta = 0 , Phi = 0 , R = 0 , Thickness = 0 , Radius = 0 ; + G4String Scintillator ; + + bool check_Theta = false ; + bool check_Phi = false ; + bool check_R = false ; + bool check_Thickness = false ; + bool check_Radius = false ; + bool check_Scintillator = false; + bool ReadingStatus = false ; + while (!ConfigFile.eof()) - { + { - getline(ConfigFile, LineBuffer); - - // If line is a Start Up DUMMYDetector bloc, Reading toggle to true - if (LineBuffer.compare(0, 13, "DUMMYDetector") == 0) - { - G4cout << "///" << G4endl ; - G4cout << "Dummy Module found: " << G4endl ; - ReadingStatus = true ; - - } - - // Else don't toggle to Reading Block Status - else ReadingStatus = false ; - - // Reading Block - while(ReadingStatus) - { - // Pickup Next Word - ConfigFile >> DataBuffer ; - - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - // Finding another telescope (safety), toggle out - else if (DataBuffer.compare(0, 13, "DUMMYDetector") == 0) { - cout << "WARNING: Another Detector is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; - ReadingStatus = false ; - } - - //Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta * deg; - cout << "Theta: " << Theta / deg << endl; - } - - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi * deg; - cout << "Phi: " << Phi / deg << endl; - } - - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R * mm; - cout << "R: " << R/mm << endl; - } - - else if (DataBuffer.compare(0, 7, "Radius=") == 0) { - check_Radius = true; - ConfigFile >> DataBuffer ; - Radius = atof(DataBuffer.c_str()) ; - Radius = Radius * mm; - cout << "DUMMYDetector Radius: " << Radius/mm << endl; - } - - else if (DataBuffer.compare(0, 10, "Thickness=") == 0) { - check_Thickness = true; - ConfigFile >> DataBuffer ; - Thickness = atof(DataBuffer.c_str()) ; - Thickness = Thickness * mm; - cout << "DUMMYDetector Thickness: " << Thickness/mm << endl; - } - - else if (DataBuffer.compare(0, 13, "Material=") == 0) { - check_Scintillator = true ; - ConfigFile >> DataBuffer ; - Scintillator = DataBuffer ; - cout << "DUMMYDetector material type: " << Scintillator << endl; - } - - /////////////////////////////////////////////////// - // If no Detector Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} - - ///////////////////////////////////////////////// - // If All necessary information there, toggle out - - if ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius && check_Scintillator) - { - AddDUMMYDetector( R , - Theta , - Phi , - Thickness , - Radius , - Scintillator ); - - // Reinitialisation of Check Boolean - - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_Thickness = false ; - check_Radius = false ; - check_Scintillator = false ; - ReadingStatus = false ; - cout << "///"<< endl ; - } - - } - } + getline(ConfigFile, LineBuffer); + + // If line is a Start Up DUMMYDetector bloc, Reading toggle to true + if (LineBuffer.compare(0, 13, "DUMMYDetector") == 0) + { + G4cout << "///" << G4endl ; + G4cout << "Dummy Module found: " << G4endl ; + ReadingStatus = true ; + + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; + + // Reading Block + while(ReadingStatus) + { + // Pickup Next Word + ConfigFile >> DataBuffer ; + + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 13, "DUMMYDetector") == 0) { + cout << "WARNING: Another Detector is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; + ReadingStatus = false ; + } + + //Angle method + else if (DataBuffer.compare(0, 6, "THETA=") == 0) { + check_Theta = true; + ConfigFile >> DataBuffer ; + Theta = atof(DataBuffer.c_str()) ; + Theta = Theta * deg; + cout << "Theta: " << Theta / deg << endl; + } + + else if (DataBuffer.compare(0, 4, "PHI=") == 0) { + check_Phi = true; + ConfigFile >> DataBuffer ; + Phi = atof(DataBuffer.c_str()) ; + Phi = Phi * deg; + cout << "Phi: " << Phi / deg << endl; + } + + else if (DataBuffer.compare(0, 2, "R=") == 0) { + check_R = true; + ConfigFile >> DataBuffer ; + R = atof(DataBuffer.c_str()) ; + R = R * mm; + cout << "R: " << R/mm << endl; + } + + else if (DataBuffer.compare(0, 7, "Radius=") == 0) { + check_Radius = true; + ConfigFile >> DataBuffer ; + Radius = atof(DataBuffer.c_str()) ; + Radius = Radius * mm; + cout << "DUMMYDetector Radius: " << Radius/mm << endl; + } + + else if (DataBuffer.compare(0, 10, "Thickness=") == 0) { + check_Thickness = true; + ConfigFile >> DataBuffer ; + Thickness = atof(DataBuffer.c_str()) ; + Thickness = Thickness * mm; + cout << "DUMMYDetector Thickness: " << Thickness/mm << endl; + } + + else if (DataBuffer.compare(0, 13, "Material=") == 0) { + check_Scintillator = true ; + ConfigFile >> DataBuffer ; + Scintillator = DataBuffer ; + cout << "DUMMYDetector material type: " << Scintillator << endl; + } + + /////////////////////////////////////////////////// + // If no Detector Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + + if ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius && check_Scintillator) + { + AddDUMMYDetector( R , + Theta , + Phi , + Thickness , + Radius , + Scintillator ); + + // Reinitialisation of Check Boolean + + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_Thickness = false ; + check_Radius = false ; + check_Scintillator = false ; + ReadingStatus = false ; + cout << "///"<< endl ; + } + + } + } } @@ -244,78 +244,74 @@ void DUMMYDetector::ReadConfiguration(string Path) // Called After DetecorConstruction::AddDetector Method void DUMMYDetector::ConstructDetector(G4LogicalVolume* world) { - G4ThreeVector Det_pos = G4ThreeVector(0, 0, 0) ; - + G4ThreeVector Det_pos = G4ThreeVector(0, 0, 0) ; + for (unsigned short i = 0 ; i < m_R.size() ; i++) - { + { G4double wX = m_R[i] * sin(m_Theta[i] ) * cos(m_Phi[i] ) ; G4double wY = m_R[i] * sin(m_Theta[i] ) * sin(m_Phi[i] ) ; - G4double wZ = m_R[i] * cos(m_Theta[i] ) ; + G4double wZ = m_R[i] * cos(m_Theta[i] ) ; - Det_pos = G4ThreeVector(wX, wY, wZ) ; + Det_pos = G4ThreeVector(wX, wY, wZ) ; // G4LogicalVolume* logicDUMMYDetector = NULL ; - - VolumeMaker(Det_pos , i+1, world) ; + + VolumeMaker(Det_pos , i+1, world) ; } } void DUMMYDetector::VolumeMaker(G4ThreeVector Det_pos, int DetNumber, G4LogicalVolume* world) - { - //////////////////////////////////////////////////////////////// - ////////////// Starting Volume Definition ////////////////////// - //////////////////////////////////////////////////////////////// - G4PVPlacement* PVPBuffer ; - - // Name of the module - std::ostringstream DetectorNumber ; - DetectorNumber << DetNumber ; - G4String Name = "DUMMYDetector" + DetectorNumber.str() ; - - int i = DetNumber-1; - - G4Material* DUMMYDetectorMaterial ; - - if(m_Scintillator[i] == "material1" ) DUMMYDetectorMaterial = m_MaterialDUMMYDetector_material1 ; - else if(m_Scintillator[i] == "material2" ) DUMMYDetectorMaterial = m_MaterialDUMMYDetector_material2 ; - else { - G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; - G4cout << "WARNING: Material Not found, default material set : material1" << endl ; - G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; - DUMMYDetectorMaterial = m_MaterialDUMMYDetector_material1; - } - - - // Definition of the volume containing the sensitive detector - if(m_DUMMYDetectorThickness[i]>0 && m_DUMMYDetectorRadius[i]>0) - { - G4Tubs* solidDUMMYDetector = new G4Tubs( Name , - 0 , - m_DUMMYDetectorRadius[i] , - m_DUMMYDetectorThickness[i]/2 , - 0*deg , - 360*deg ); - - G4LogicalVolume* logicDUMMYDetector = new G4LogicalVolume(solidDUMMYDetector, DUMMYDetectorMaterial, Name+ "_Scintillator", 0, 0, 0); - logicDUMMYDetector->SetSensitiveDetector(m_DUMMYDetectorScorer); - - G4VisAttributes* PlastVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; - logicDUMMYDetector->SetVisAttributes(PlastVisAtt) ; - - - - PVPBuffer = new G4PVPlacement( 0 , - Det_pos , - logicDUMMYDetector , - Name + "_Scintillator" , - world , - false , - 0 ); - - - - } - } + { + //////////////////////////////////////////////////////////////// + ////////////// Starting Volume Definition ////////////////////// + //////////////////////////////////////////////////////////////// + G4PVPlacement* PVPBuffer ; + + // Name of the module + std::ostringstream DetectorNumber ; + DetectorNumber << DetNumber ; + G4String Name = "DUMMYDetector" + DetectorNumber.str() ; + + int i = DetNumber-1; + + G4Material* DUMMYDetectorMaterial ; + + if(m_Scintillator[i] == "material1" ) DUMMYDetectorMaterial = m_MaterialDUMMYDetector_material1 ; + else if(m_Scintillator[i] == "material2" ) DUMMYDetectorMaterial = m_MaterialDUMMYDetector_material2 ; + else { + G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; + G4cout << "WARNING: Material Not found, default material set : material1" << endl ; + G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; + DUMMYDetectorMaterial = m_MaterialDUMMYDetector_material1; + } + + // Definition of the volume containing the sensitive detector + if(m_DUMMYDetectorThickness[i]>0 && m_DUMMYDetectorRadius[i]>0) + { + G4Tubs* solidDUMMYDetector = new G4Tubs( Name, + 0 , + m_DUMMYDetectorRadius[i], + m_DUMMYDetectorThickness[i]/2, + 0*deg, + 360*deg); + + G4LogicalVolume* logicDUMMYDetector = new G4LogicalVolume(solidDUMMYDetector, DUMMYDetectorMaterial, Name+ "_Scintillator", 0, 0, 0); + logicDUMMYDetector->SetSensitiveDetector(m_DUMMYDetectorScorer); + + G4VisAttributes* PlastVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; + logicDUMMYDetector->SetVisAttributes(PlastVisAtt) ; + + + + PVPBuffer = new G4PVPlacement( 0, + Det_pos, + logicDUMMYDetector, + Name + "_Scintillator", + world, + false, + 0 ); + } + } // Add Detector branch to the EventTree. // Called After DetecorConstruction::AddDetector Method @@ -330,81 +326,81 @@ void DUMMYDetector::InitializeRootOutput() // Called at in the EventAction::EndOfEventAvtion void DUMMYDetector::ReadSensitive(const G4Event* event) { - G4String DetectorNumber ; - m_Event->Clear() ; + G4String DetectorNumber ; + m_Event->Clear() ; ////////////////////////////////////////////////////////////////////////////////////// //////////////////////// Used to Read Event Map of detector ////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - std::map<G4int, G4int*>::iterator DetectorNumber_itr ; - std::map<G4int, G4double*>::iterator Energy_itr ; - std::map<G4int, G4double*>::iterator Time_itr ; - - G4THitsMap<G4int>* DetectorNumberHitMap ; - G4THitsMap<G4double>* EnergyHitMap ; - G4THitsMap<G4double>* TimeHitMap ; - + std::map<G4int, G4int*>::iterator DetectorNumber_itr ; + std::map<G4int, G4double*>::iterator Energy_itr ; + std::map<G4int, G4double*>::iterator Time_itr ; + + G4THitsMap<G4int>* DetectorNumberHitMap ; + G4THitsMap<G4double>* EnergyHitMap ; + G4THitsMap<G4double>* TimeHitMap ; + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// // Read the Scorer associate to the Silicon Strip - //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("DUMMYDetectorScorer/DUMMYDetectorNumber") ; - DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; + //Detector Number + G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("DUMMYDetectorScorer/DUMMYDetectorNumber") ; + DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; + DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("DUMMYDetectorScorer/Energy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; + //Energy + G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("DUMMYDetectorScorer/Energy") ; + EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)); + Energy_itr = EnergyHitMap->GetMap()->begin() ; - //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("DUMMYDetectorScorer/Time") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; + //Time of Flight + G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("DUMMYDetectorScorer/Time") ; + TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; + Time_itr = TimeHitMap->GetMap()->begin(); - G4int sizeN = DetectorNumberHitMap->entries() ; - G4int sizeE = EnergyHitMap->entries() ; - G4int sizeT = TimeHitMap->entries() ; + G4int sizeN = DetectorNumberHitMap->entries(); + G4int sizeE = EnergyHitMap->entries(); + G4int sizeT = TimeHitMap->entries(); // Loop on DUMMYDetector Number for (G4int l = 0 ; l < sizeN ; l++) { - G4int N = *(DetectorNumber_itr->second) ; - G4int NTrackID = DetectorNumber_itr->first - N ; + G4int N = *(DetectorNumber_itr->second) ; + G4int NTrackID = DetectorNumber_itr->first - N; if (N > 0) { - m_Event->SetDUMMYDetectorNumber(N) ; - - // Energy - Energy_itr = EnergyHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeE ; h++) { - G4int ETrackID = Energy_itr->first - N ; - G4double E = *(Energy_itr->second) ; - - if (ETrackID == NTrackID) { - m_Event->SetEnergy(RandGauss::shoot(E, E*ResoEnergy/100./2.35)) ; - } - - Energy_itr++; - } - - - // Time - Time_itr = TimeHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N ; - G4double T = *(Time_itr->second) ; - - if (TTrackID == NTrackID) { - m_Event->SetTime(RandGauss::shoot(T, ResoTime)) ; - } - - Time_itr++; - } + m_Event->SetDUMMYDetectorNumber(N) ; + + // Energy + Energy_itr = EnergyHitMap->GetMap()->begin(); + for (G4int h = 0 ; h < sizeE ; h++) { + G4int ETrackID = Energy_itr->first - N ; + G4double E = *(Energy_itr->second) ; + + if (ETrackID == NTrackID) { + m_Event->SetEnergy(RandGauss::shoot(E, E*ResoEnergy/100./2.35)) ; + } + + Energy_itr++; + } + + + // Time + Time_itr = TimeHitMap->GetMap()->begin(); + for (G4int h = 0 ; h < sizeT ; h++) { + G4int TTrackID = Time_itr->first - N ; + G4double T = *(Time_itr->second) ; + + if (TTrackID == NTrackID) { + m_Event->SetTime(RandGauss::shoot(T, ResoTime)) ; + } + + Time_itr++; + } } @@ -412,62 +408,61 @@ void DUMMYDetector::ReadSensitive(const G4Event* event) } // clear map for next event - TimeHitMap ->clear() ; - DetectorNumberHitMap ->clear() ; - EnergyHitMap ->clear() ; + TimeHitMap ->clear() ; + DetectorNumberHitMap ->clear() ; + EnergyHitMap ->clear() ; } //////////////////////////////////////////////////////////////// void DUMMYDetector::InitializeMaterial() - { - - //////////////////////////////////////////////////////////////// - /////////////////Element Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - G4String symbol ; - G4double density = 0. , a = 0, z = 0 ; - G4int ncomponents = 0, natoms = 0, fractionmass = 0 ; - - // for DUMMYDetector - G4Element* H = new G4Element("Hydrogen" , symbol = "H" , z = 1 , a = 1.01 * g / mole); - G4Element* C = new G4Element("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); - G4Element* Pb = new G4Element("Lead" , symbol = "Pb" , z = 82 , a = 207.2 * g / mole); - //////////////////////////////////////////////////////////////// - /////////////////Material Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - - - // DUMMYDetector BC-400 - density = 1.032 * g / cm3; - m_MaterialDUMMYDetector_material1 = new G4Material("DUMMYDetector_material1", density, ncomponents = 2); - m_MaterialDUMMYDetector_material1->AddElement(H , natoms = 10); - m_MaterialDUMMYDetector_material1->AddElement(C , natoms = 9); - - // DUMMYDetector BC-452 Pb 2% - density = 1.05 * g / cm3; - m_MaterialDUMMYDetector_material2 = new G4Material("DUMMYDetector_material2", density, ncomponents = 3); - m_MaterialDUMMYDetector_material2->AddElement(H , natoms = 10); - m_MaterialDUMMYDetector_material2->AddElement(C , natoms = 9); - m_MaterialDUMMYDetector_material2->AddElement(Pb , fractionmass=2*perCent); - - } - -//////////////////////////////////////////////////////////////// + { + //////////////////////////////////////////////////////////////// + /////////////////Element Definition /////////////////////////// + //////////////////////////////////////////////////////////////// + G4String symbol ; + G4double density = 0. , a = 0, z = 0 ; + G4int ncomponents = 0, natoms = 0, fractionmass = 0 ; + + // for DUMMYDetector + G4Element* H = new G4Element ("Hydrogen" , symbol = "H" , z = 1 , a = 1.01 * g / mole); + G4Element* C = new G4Element ("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); + G4Element* Pb = new G4Element ("Lead" , symbol = "Pb" , z = 82 , a = 207.2 * g / mole); + //////////////////////////////////////////////////////////////// + /////////////////Material Definition /////////////////////////// + //////////////////////////////////////////////////////////////// + + + // DUMMYDetector BC-400 + density = 1.032 * g / cm3; + m_MaterialDUMMYDetector_material1 = new G4Material("DUMMYDetector_material1", density, ncomponents = 2); + m_MaterialDUMMYDetector_material1->AddElement(H , natoms = 10); + m_MaterialDUMMYDetector_material1->AddElement(C , natoms = 9); + + // DUMMYDetector BC-452 Pb 2% + density = 1.05 * g / cm3; + m_MaterialDUMMYDetector_material2 = new G4Material("DUMMYDetector_material2", density, ncomponents = 3); + m_MaterialDUMMYDetector_material2->AddElement(H , natoms = 10); + m_MaterialDUMMYDetector_material2->AddElement(C , natoms = 9); + m_MaterialDUMMYDetector_material2->AddElement(Pb , fractionmass=2*perCent); + + } + +//////////////////////////////////////////////////////////////// void DUMMYDetector::InitializeScorers() - { - m_DUMMYDetectorScorer = new G4MultiFunctionalDetector("DUMMYDetectorScorer") ; - G4SDManager::GetSDMpointer()->AddNewDetector(m_DUMMYDetectorScorer); - - G4VPrimitiveScorer* DetNbr = new PSDetectorNumber("DUMMYDetectorNumber","DUMMYDetector", 0) ; - G4VPrimitiveScorer* Energy = new PSEnergy("Energy","DUMMYDetector", 0) ; - G4VPrimitiveScorer* Time = new PSTOF("Time","DUMMYDetector", 0) ; - - //and register it to the multifunctionnal detector - m_DUMMYDetectorScorer->RegisterPrimitive(DetNbr) ; - m_DUMMYDetectorScorer->RegisterPrimitive(Energy) ; - m_DUMMYDetectorScorer->RegisterPrimitive(Time) ; - - - } + { + m_DUMMYDetectorScorer = new G4MultiFunctionalDetector("DUMMYDetectorScorer") ; + G4SDManager::GetSDMpointer()->AddNewDetector(m_DUMMYDetectorScorer); + + G4VPrimitiveScorer* DetNbr = new PSDetectorNumber("DUMMYDetectorNumber","DUMMYDetector", 0) ; + G4VPrimitiveScorer* Energy = new PSEnergy("Energy","DUMMYDetector", 0); + G4VPrimitiveScorer* Time = new PSTOF("Time","DUMMYDetector", 0); + + //and register it to the multifunctionnal detector + m_DUMMYDetectorScorer->RegisterPrimitive(DetNbr); + m_DUMMYDetectorScorer->RegisterPrimitive(Energy); + m_DUMMYDetectorScorer->RegisterPrimitive(Time); + + + } //////////////////////////////////////////////////////////////// diff --git a/NPSimulation/src/EventGeneratorBeam.cc b/NPSimulation/src/EventGeneratorBeam.cc index 5d2639361..bbc6f420a 100644 --- a/NPSimulation/src/EventGeneratorBeam.cc +++ b/NPSimulation/src/EventGeneratorBeam.cc @@ -42,10 +42,10 @@ using namespace CLHEP; EventGeneratorBeam::EventGeneratorBeam() { m_InitConditions = new TInitialConditions(); - m_Target = NULL ; - m_beamA = 0 ; - m_beamZ = 0 ; - m_particle = NULL ; + m_Target = NULL ; + m_beamA = 0 ; + m_beamZ = 0 ; + m_particle = NULL ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -55,12 +55,12 @@ EventGeneratorBeam::~EventGeneratorBeam() } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void EventGeneratorBeam::SetTarget(Target* Target) +void EventGeneratorBeam::SetTarget(Target* Target) { - if(Target!=0) - { - m_Target = Target; - } + if(Target!=0) + { + m_Target = Target; + } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -74,16 +74,16 @@ void EventGeneratorBeam::ReadConfiguration(string Path) ifstream ReactionFile; ReactionFile.open(Path.c_str()); - bool ReadingStatus = false ; - bool check_Z = false ; - bool check_A = false ; - bool check_Energy = false ; - bool check_EnergySpread = false ; - bool check_FWHMX = false ; - bool check_FWHMY = false ; - bool check_SigmaThetaX = false ; - bool check_SigmaPhiY = false ; - + bool ReadingStatus = false ; + bool check_Z = false ; + bool check_A = false ; + bool check_Energy = false ; + bool check_EnergySpread = false ; + bool check_FWHMX = false ; + bool check_FWHMY = false ; + bool check_SigmaThetaX = false ; + bool check_SigmaPhiY = false ; + if (ReactionFile.is_open()) {} else { return; } @@ -97,106 +97,106 @@ void EventGeneratorBeam::ReadConfiguration(string Path) ReadingStatus = true ; } - while(ReadingStatus){ - - ReactionFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + while(ReadingStatus){ + + ReactionFile >> DataBuffer; + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - else if (DataBuffer.compare(0, 10, "ParticleZ=") == 0) { - check_Z = true ; - ReactionFile >> DataBuffer; - m_beamZ = atof(DataBuffer.c_str()); - - if(check_A) - G4cout << "Beam Particle: Z:" << m_beamZ << " A:" << m_beamA << G4endl; - - } + else if (DataBuffer.compare(0, 10, "ParticleZ=") == 0) { + check_Z = true ; + ReactionFile >> DataBuffer; + m_beamZ = atof(DataBuffer.c_str()); + + if(check_A) + G4cout << "Beam Particle: Z:" << m_beamZ << " A:" << m_beamA << G4endl; + + } - - else if (DataBuffer.compare(0, 10, "ParticleA=") == 0) { - check_A = true ; - ReactionFile >> DataBuffer; - m_beamA = atof(DataBuffer.c_str()); - - if(check_Z) - G4cout << "Beam Particle: Z:" << m_beamZ << " A:" << m_beamA << G4endl; - - } + + else if (DataBuffer.compare(0, 10, "ParticleA=") == 0) { + check_A = true ; + ReactionFile >> DataBuffer; + m_beamA = atof(DataBuffer.c_str()); + + if(check_Z) + G4cout << "Beam Particle: Z:" << m_beamZ << " A:" << m_beamA << G4endl; + + } - else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { - check_Energy = true ; - ReactionFile >> DataBuffer; - m_BeamEnergy = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy: " << m_BeamEnergy / MeV << " MeV" << G4endl; - } + else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { + check_Energy = true ; + ReactionFile >> DataBuffer; + m_BeamEnergy = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy: " << m_BeamEnergy / MeV << " MeV" << G4endl; + } - else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { - check_EnergySpread = true ; - ReactionFile >> DataBuffer; - m_BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy Spread: " << m_BeamEnergySpread / MeV << " MeV" << G4endl; - } + else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { + check_EnergySpread = true ; + ReactionFile >> DataBuffer; + m_BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy Spread: " << m_BeamEnergySpread / MeV << " MeV" << G4endl; + } - else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { - check_FWHMX = true ; - ReactionFile >> DataBuffer; - m_SigmaX = atof(DataBuffer.c_str()) * mm; - G4cout << "Sigma X: " << m_SigmaX / mm << " mm" << G4endl; - } + else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { + check_FWHMX = true ; + ReactionFile >> DataBuffer; + m_SigmaX = atof(DataBuffer.c_str()) * mm; + G4cout << "Sigma X: " << m_SigmaX / mm << " mm" << G4endl; + } - else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { - check_FWHMY = true ; - ReactionFile >> DataBuffer; - m_SigmaY = atof(DataBuffer.c_str()) * mm; - G4cout << "Sigma Y: " << m_SigmaY / mm << " mm" << G4endl; - } + else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { + check_FWHMY = true ; + ReactionFile >> DataBuffer; + m_SigmaY = atof(DataBuffer.c_str()) * mm; + G4cout << "Sigma Y: " << m_SigmaY / mm << " mm" << G4endl; + } - else if (DataBuffer.compare(0, 12, "SigmaThetaX=") == 0) { - check_SigmaThetaX = true ; - ReactionFile >> DataBuffer; - m_SigmaThetaX = atof(DataBuffer.c_str()) * deg; - G4cout << "Sigma Theta X: " << m_SigmaThetaX / deg << " deg" << G4endl; - } - - else if (DataBuffer.compare(0, 10, "SigmaPhiY=") == 0) { - check_SigmaPhiY = true ; - ReactionFile >> DataBuffer; - m_SigmaPhiY = atof(DataBuffer.c_str()) * deg; - G4cout << "Sigma Phi Y: " << m_SigmaPhiY / deg << " deg" << G4endl; - } - - /////////////////////////////////////////////////// - // If no Beam Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if( check_Z && check_A && check_Energy && check_EnergySpread && check_FWHMX && check_FWHMY && check_SigmaThetaX && check_SigmaPhiY ) - ReadingStatus = false ; - } + else if (DataBuffer.compare(0, 12, "SigmaThetaX=") == 0) { + check_SigmaThetaX = true ; + ReactionFile >> DataBuffer; + m_SigmaThetaX = atof(DataBuffer.c_str()) * deg; + G4cout << "Sigma Theta X: " << m_SigmaThetaX / deg << " deg" << G4endl; + } + + else if (DataBuffer.compare(0, 10, "SigmaPhiY=") == 0) { + check_SigmaPhiY = true ; + ReactionFile >> DataBuffer; + m_SigmaPhiY = atof(DataBuffer.c_str()) * deg; + G4cout << "Sigma Phi Y: " << m_SigmaPhiY / deg << " deg" << G4endl; + } + + /////////////////////////////////////////////////// + // If no Beam Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if( check_Z && check_A && check_Energy && check_EnergySpread && check_FWHMX && check_FWHMY && check_SigmaThetaX && check_SigmaPhiY ) + ReadingStatus = false ; + } } - if( !check_Z || !check_A || !check_Energy || !check_EnergySpread || !check_FWHMX || !check_FWHMY || !check_SigmaThetaX || !check_SigmaPhiY ) - {cout << "WARNING : Token Sequence Incomplete, Beam definition could not be Fonctionnal" << endl ;} - + if( !check_Z || !check_A || !check_Energy || !check_EnergySpread || !check_FWHMX || !check_FWHMY || !check_SigmaThetaX || !check_SigmaPhiY ) + {cout << "WARNING : Token Sequence Incomplete, Beam definition could not be Fonctionnal" << endl ;} + cout << "///////////////////////////////////////////////////" << endl << endl ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EventGeneratorBeam::GenerateEvent(G4Event* anEvent, G4ParticleGun* particleGun) { - //--------------write the DeDx Table ------------------- + //--------------write the DeDx Table ------------------- if( anEvent->GetEventID()==0) - { - m_particle = G4ParticleTable::GetParticleTable()->GetIon(m_beamZ, m_beamA , 0.); - - if(m_Target!=0 ) - m_Target->WriteDEDXTable(m_particle ,0, m_BeamEnergy+4*m_BeamEnergySpread); - } - + { + m_particle = G4ParticleTable::GetParticleTable()->GetIon(m_beamZ, m_beamA , 0.); + + if(m_Target!=0 ) + m_Target->WriteDEDXTable(m_particle ,0, m_BeamEnergy+4*m_BeamEnergySpread); + } + m_InitConditions->Clear(); /////////////////////////////////////////////////////////////////////// @@ -211,14 +211,14 @@ void EventGeneratorBeam::GenerateEvent(G4Event* anEvent, G4ParticleGun* particle G4double FinalBeamEnergy = 0 ; G4double InitialBeamEnergy = RandGauss::shoot(m_BeamEnergy, m_BeamEnergySpread); - m_Target->CalculateBeamInteraction( 0, m_SigmaX, 0, m_SigmaThetaX, - 0, m_SigmaY, 0, m_SigmaPhiY, - InitialBeamEnergy, - m_particle, - InterCoord, Beam_thetaX, Beam_phiY, - Beam_theta, Beam_phi, - FinalBeamEnergy); - + m_Target->CalculateBeamInteraction( 0, m_SigmaX, 0, m_SigmaThetaX, + 0, m_SigmaY, 0, m_SigmaPhiY, + InitialBeamEnergy, + m_particle, + InterCoord, Beam_thetaX, Beam_phiY, + Beam_theta, Beam_phi, + FinalBeamEnergy); + // write vertex position to ROOT file G4double x0 = InterCoord.x(); G4double y0 = InterCoord.y(); @@ -243,16 +243,16 @@ void EventGeneratorBeam::GenerateEvent(G4Event* anEvent, G4ParticleGun* particle G4double particle_energy = RandGauss::shoot(m_BeamEnergy, m_BeamEnergySpread); // Direction of particle, energy and laboratory angle - G4double momentum_x = sin(Beam_theta) * cos(Beam_phi) ; - G4double momentum_y = sin(Beam_theta) * sin(Beam_phi) ; - G4double momentum_z = cos(Beam_theta) ; + G4double momentum_x = sin(Beam_theta) * cos(Beam_phi) ; + G4double momentum_y = sin(Beam_theta) * sin(Beam_phi) ; + G4double momentum_z = cos(Beam_theta) ; //Set the gun to shoot - particleGun->SetParticleMomentumDirection(G4ThreeVector(momentum_x, momentum_y, momentum_z)) ; - particleGun->SetParticleEnergy(particle_energy) ; - particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)) ; + particleGun->SetParticleMomentumDirection(G4ThreeVector(momentum_x, momentum_y, momentum_z)) ; + particleGun->SetParticleEnergy(particle_energy) ; + particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)) ; //Shoot the light particle - particleGun->GeneratePrimaryVertex(anEvent) ; + particleGun->GeneratePrimaryVertex(anEvent) ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/NPSimulation/src/EventGeneratorIsotropic.cc b/NPSimulation/src/EventGeneratorIsotropic.cc index e2e9b384b..3771fb438 100644 --- a/NPSimulation/src/EventGeneratorIsotropic.cc +++ b/NPSimulation/src/EventGeneratorIsotropic.cc @@ -67,16 +67,16 @@ void EventGeneratorIsotropic::ReadConfiguration(string Path) string LineBuffer; string DataBuffer; - bool ReadingStatus = false ; - bool check_EnergyLow = false ; - bool check_EnergyHigh = false ; - bool check_HalfOpenAngleMin = false ; - bool check_HalfOpenAngleMax = false ; - bool check_x0 = false ; - bool check_y0 = false ; - bool check_z0 = false ; - bool check_particle = false ; - + bool ReadingStatus = false ; + bool check_EnergyLow = false ; + bool check_EnergyHigh = false ; + bool check_HalfOpenAngleMin = false ; + bool check_HalfOpenAngleMax = false ; + bool check_x0 = false ; + bool check_y0 = false ; + bool check_z0 = false ; + bool check_particle = false ; + ////////Reaction Setting needs/////// string particle ; ////////////////////////////////////////////////////////////////////////////////////////// @@ -85,98 +85,98 @@ void EventGeneratorIsotropic::ReadConfiguration(string Path) if (ReactionFile.is_open()) {} else { - return; - } + return; + } while (!ReactionFile.eof()) { - //Pick-up next line - getline(ReactionFile, LineBuffer); - - if (LineBuffer.compare(0, 9, "Isotropic") == 0) { - G4cout << "Isotropic Source Found" << G4endl ; - ReadingStatus = true;} - - - while (ReadingStatus) - { - ReactionFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - else if (DataBuffer.compare(0, 10, "EnergyLow=") == 0) { - check_EnergyLow = true ; - ReactionFile >> DataBuffer; - m_EnergyLow = atof(DataBuffer.c_str()) * MeV; - G4cout << "Minimum energy " << m_EnergyLow / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 11, "EnergyHigh=") == 0) { - check_EnergyHigh = true ; - ReactionFile >> DataBuffer; - m_EnergyHigh = atof(DataBuffer.c_str()) * MeV; - G4cout << "Maximum energy " << m_EnergyHigh / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "HalfOpenAngleMin=") == 0) { - check_HalfOpenAngleMin = true ; - ReactionFile >> DataBuffer; - m_HalfOpenAngleMin = atof(DataBuffer.c_str()) * deg; - G4cout << "HalfOpenAngleMin " << m_HalfOpenAngleMin / deg << " degree" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "HalfOpenAngleMax=") == 0) { - check_HalfOpenAngleMax = true ; - ReactionFile >> DataBuffer; - m_HalfOpenAngleMax = atof(DataBuffer.c_str()) * deg; - G4cout << "HalfOpenAngleMax " << m_HalfOpenAngleMax / deg << " degree" << G4endl; - } - - else if (DataBuffer.compare(0, 3, "x0=") == 0) { - check_x0 = true ; - ReactionFile >> DataBuffer; - m_x0 = atof(DataBuffer.c_str()) * mm; - G4cout << "x0 " << m_x0 << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 3, "y0=") == 0) { - check_y0 = true ; - ReactionFile >> DataBuffer; - m_y0 = atof(DataBuffer.c_str()) * mm; - G4cout << "y0 " << m_y0 << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 3, "z0=") == 0) { - check_z0 = true ; - ReactionFile >> DataBuffer; - m_y0 = atof(DataBuffer.c_str()) * mm; - G4cout << "y0 " << m_y0 << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 9, "particle=") == 0) { - check_particle = true ; - ReactionFile >> DataBuffer; - particle = DataBuffer; - G4cout << "particle " << particle << G4endl; - m_particle = G4ParticleTable::GetParticleTable()->FindParticle(particle); - } - - // If no isotropic Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if( check_EnergyLow && check_EnergyHigh && check_HalfOpenAngleMin && check_HalfOpenAngleMax && check_x0 && check_y0 && check_z0 && check_particle ) - ReadingStatus = false ; - - } - + //Pick-up next line + getline(ReactionFile, LineBuffer); + + if (LineBuffer.compare(0, 9, "Isotropic") == 0) { + G4cout << "Isotropic Source Found" << G4endl ; + ReadingStatus = true;} + + + while (ReadingStatus) + { + ReactionFile >> DataBuffer; + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + else if (DataBuffer.compare(0, 10, "EnergyLow=") == 0) { + check_EnergyLow = true ; + ReactionFile >> DataBuffer; + m_EnergyLow = atof(DataBuffer.c_str()) * MeV; + G4cout << "Minimum energy " << m_EnergyLow / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 11, "EnergyHigh=") == 0) { + check_EnergyHigh = true ; + ReactionFile >> DataBuffer; + m_EnergyHigh = atof(DataBuffer.c_str()) * MeV; + G4cout << "Maximum energy " << m_EnergyHigh / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "HalfOpenAngleMin=") == 0) { + check_HalfOpenAngleMin = true ; + ReactionFile >> DataBuffer; + m_HalfOpenAngleMin = atof(DataBuffer.c_str()) * deg; + G4cout << "HalfOpenAngleMin " << m_HalfOpenAngleMin / deg << " degree" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "HalfOpenAngleMax=") == 0) { + check_HalfOpenAngleMax = true ; + ReactionFile >> DataBuffer; + m_HalfOpenAngleMax = atof(DataBuffer.c_str()) * deg; + G4cout << "HalfOpenAngleMax " << m_HalfOpenAngleMax / deg << " degree" << G4endl; + } + + else if (DataBuffer.compare(0, 3, "x0=") == 0) { + check_x0 = true ; + ReactionFile >> DataBuffer; + m_x0 = atof(DataBuffer.c_str()) * mm; + G4cout << "x0 " << m_x0 << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 3, "y0=") == 0) { + check_y0 = true ; + ReactionFile >> DataBuffer; + m_y0 = atof(DataBuffer.c_str()) * mm; + G4cout << "y0 " << m_y0 << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 3, "z0=") == 0) { + check_z0 = true ; + ReactionFile >> DataBuffer; + m_y0 = atof(DataBuffer.c_str()) * mm; + G4cout << "y0 " << m_y0 << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 9, "particle=") == 0) { + check_particle = true ; + ReactionFile >> DataBuffer; + particle = DataBuffer; + G4cout << "particle " << particle << G4endl; + m_particle = G4ParticleTable::GetParticleTable()->FindParticle(particle); + } + + // If no isotropic Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if( check_EnergyLow && check_EnergyHigh && check_HalfOpenAngleMin && check_HalfOpenAngleMax && check_x0 && check_y0 && check_z0 && check_particle ) + ReadingStatus = false ; + + } + } - if( !check_EnergyLow || !check_EnergyHigh || !check_HalfOpenAngleMin || !check_HalfOpenAngleMax || !check_x0 || !check_y0 || !check_z0 || !check_particle ) - {cout << "WARNING : Token Sequence Incomplete, Isotropic definition could not be Fonctionnal" << endl ;} - + if( !check_EnergyLow || !check_EnergyHigh || !check_HalfOpenAngleMin || !check_HalfOpenAngleMax || !check_x0 || !check_y0 || !check_z0 || !check_particle ) + {cout << "WARNING : Token Sequence Incomplete, Isotropic definition could not be Fonctionnal" << endl ;} + cout << "///////////////////////////////////////////////////" << endl << endl ; } diff --git a/NPSimulation/src/EventGeneratorPhaseSpace.cc b/NPSimulation/src/EventGeneratorPhaseSpace.cc index ed612b9ad..e858d6f52 100644 --- a/NPSimulation/src/EventGeneratorPhaseSpace.cc +++ b/NPSimulation/src/EventGeneratorPhaseSpace.cc @@ -17,7 +17,7 @@ * channel during an experiment. Manage up to 18 body phase space * *---------------------------------------------------------------------------* * Comment: * - * * + * * * * *****************************************************************************/ @@ -52,51 +52,51 @@ using namespace CLHEP; EventGeneratorPhaseSpace::EventGeneratorPhaseSpace() { //------------- Default Constructor ------------- - m_InitConditions = new TInitialConditions() ; - m_Target = new Target() ; - m_SigmaX = 0 ; - m_SigmaY = 0 ; - m_SigmaThetaX = 0 ; - m_SigmaPhiY = 0 ; - m_EventWeight = 0 ; + m_InitConditions = new TInitialConditions() ; + m_Target = new Target() ; + m_SigmaX = 0 ; + m_SigmaY = 0 ; + m_SigmaThetaX = 0 ; + m_SigmaPhiY = 0 ; + m_EventWeight = 0 ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... EventGeneratorPhaseSpace::~EventGeneratorPhaseSpace() { //------------- Default Destructor ------------ - delete m_InitConditions ; + delete m_InitConditions ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void EventGeneratorPhaseSpace::SetTarget(Target* Target) +void EventGeneratorPhaseSpace::SetTarget(Target* Target) { - if(Target!=0) - m_Target = Target; + if(Target!=0) + m_Target = Target; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -EventGeneratorPhaseSpace::EventGeneratorPhaseSpace( G4ParticleDefinition* BeamParticle , - G4ParticleDefinition* TargetParticle , - vector<G4ParticleDefinition*> ReactionProducts , - double BeamEnergy , - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY ) +EventGeneratorPhaseSpace::EventGeneratorPhaseSpace( G4ParticleDefinition* BeamParticle, + G4ParticleDefinition* TargetParticle, + vector<G4ParticleDefinition*> ReactionProducts, + double BeamEnergy, + double BeamEnergySpread, + double SigmaX, + double SigmaY, + double SigmaThetaX, + double SigmaPhiY) { //------------- Constructor with nuclei names and beam energy ------------ - SetEverything( BeamParticle , - TargetParticle , - ReactionProducts , - BeamEnergy , - BeamEnergySpread , - SigmaX , - SigmaY , - SigmaThetaX , - SigmaPhiY ); - - m_EventWeight = 0 ; + SetEverything( BeamParticle, + TargetParticle, + ReactionProducts, + BeamEnergy, + BeamEnergySpread, + SigmaX, + SigmaY, + SigmaThetaX, + SigmaPhiY); + + m_EventWeight = 0; } @@ -127,16 +127,16 @@ void EventGeneratorPhaseSpace::ReadConfiguration(string Path) G4ParticleDefinition* BeamParticle = NULL ; G4ParticleDefinition* TargetParticle = NULL ; - bool ReadingStatus = false ; - bool check_Beam = false ; - bool check_Target = false ; - bool check_ReactionProducts = false ; - bool check_BeamEnergy = false ; - bool check_BeamEnergySpread = false ; - bool check_FWHMX = false ; - bool check_FWHMY = false ; - bool check_EmmitanceTheta = false ; - bool check_EmmitancePhi = false ; + bool ReadingStatus = false ; + bool check_Beam = false ; + bool check_Target = false ; + bool check_ReactionProducts = false ; + bool check_BeamEnergy = false ; + bool check_BeamEnergySpread = false ; + bool check_FWHMX = false ; + bool check_FWHMY = false ; + bool check_EmmitanceTheta = false ; + bool check_EmmitancePhi = false ; ////////////////////////////////////////////////////////////////////////////////////////// ifstream ReactionFile; @@ -144,8 +144,8 @@ void EventGeneratorPhaseSpace::ReadConfiguration(string Path) if (ReactionFile.is_open()) {} else { - return; - } + return; + } while (!ReactionFile.eof()) { //Pick-up next line @@ -154,163 +154,163 @@ void EventGeneratorPhaseSpace::ReadConfiguration(string Path) if (LineBuffer.compare(0, 10, "PhaseSpace") == 0) { ReadingStatus = true ;} -while(ReadingStatus){ - - ReactionFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - else if (DataBuffer.compare(0, 5, "Beam=") == 0) { - check_Beam = true ; - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int A = atoi(DataBuffer.c_str()); - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int Z = atoi(DataBuffer.c_str()); - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int EXX = atoi(DataBuffer.c_str())*MeV; - - G4ParticleDefinition* ParticleBuffer = G4ParticleTable::GetParticleTable()->GetIon(Z, A, EXX) ; - BeamParticle = ParticleBuffer ; - - G4cout << "Beam : A=" << A << " Z=" << Z << " Excitation Energy = " << EXX/MeV << "MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 7, "Target=") == 0) { - check_Target = true ; - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int A = atoi(DataBuffer.c_str()); - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int Z = atoi(DataBuffer.c_str()); - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int EXX = atoi(DataBuffer.c_str())*MeV; - - G4ParticleDefinition* ParticleBuffer = G4ParticleTable::GetParticleTable()->GetIon(Z, A, EXX) ; - TargetParticle = ParticleBuffer ; - - G4cout << "Target : A=" << A << " Z=" << Z << " Excitation Energy = " << EXX/MeV << "MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { - check_BeamEnergy = true ; - ReactionFile >> DataBuffer; - BeamEnergy = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { - check_BeamEnergySpread = true ; - ReactionFile >> DataBuffer; - BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy Spread " << BeamEnergySpread / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { - check_FWHMX = true ; - ReactionFile >> DataBuffer; - SigmaX = atof(DataBuffer.c_str()) * mm; - G4cout << "Beam FWHM X " << SigmaX << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { - check_FWHMY = true ; - ReactionFile >> DataBuffer; - SigmaY = atof(DataBuffer.c_str()) * mm; - G4cout << "Beam FWHM Y " << SigmaX << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 19, "SigmaThetaX=") == 0) { - check_EmmitanceTheta = true ; - ReactionFile >> DataBuffer; - SigmaThetaX = atof(DataBuffer.c_str()) * deg; - G4cout << "Beam Emmitance Theta " << SigmaThetaX / deg << " deg" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "SigmaPhiY=") == 0) { - check_EmmitancePhi = true ; - ReactionFile >> DataBuffer; - SigmaPhiY = atof(DataBuffer.c_str()) * deg; - G4cout << "Beam Emmitance Phi " << SigmaPhiY / deg << " deg" << G4endl; - } - - else if (DataBuffer.compare(0, 13, "DecayProduct=") == 0) { - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int A = atoi(DataBuffer.c_str()); - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int Z = atoi(DataBuffer.c_str()); - ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; - int EXX = atoi(DataBuffer.c_str())*MeV; - - G4ParticleDefinition* ParticleBuffer ; - - if ( A==1 && Z==0 ) - ParticleBuffer = G4ParticleTable::GetParticleTable()->FindParticle("neutron"); - else if ( A==1 && Z==1) - ParticleBuffer = G4ParticleTable::GetParticleTable()->FindParticle("proton"); -// else if ( A==2 && Z==0) -// ParticleBuffer = G4ParticleTable::GetParticleTable()->FindParticle("neutron"); -// ParticleBuffer->SetPDGMass( ParticleBuffer->GetPDGMass*2); - else - ParticleBuffer = G4ParticleTable::GetParticleTable()->GetIon(Z, A, EXX) ; - - ReactionProducts.push_back(ParticleBuffer); - - G4cout << "Decay Product: A=" << A << " Z=" << Z << " Excitation Energy = " << EXX/MeV << "MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 21, "EndOfDecayProductList") == 0) { - check_ReactionProducts = true ; - } - - - /////////////////////////////////////////////////// - // If no Transfert Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if( check_Beam && check_Target && check_BeamEnergy && check_BeamEnergySpread && check_FWHMX && check_FWHMY && check_EmmitanceTheta - && check_EmmitancePhi && check_ReactionProducts) - ReadingStatus = false ; - - } - - - } + while(ReadingStatus){ + + ReactionFile >> DataBuffer; + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + else if (DataBuffer.compare(0, 5, "Beam=") == 0) { + check_Beam = true ; + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int A = atoi(DataBuffer.c_str()); + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int Z = atoi(DataBuffer.c_str()); + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int EXX = atoi(DataBuffer.c_str())*MeV; + + G4ParticleDefinition* ParticleBuffer = G4ParticleTable::GetParticleTable()->GetIon(Z, A, EXX) ; + BeamParticle = ParticleBuffer ; + + G4cout << "Beam : A=" << A << " Z=" << Z << " Excitation Energy = " << EXX/MeV << "MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 7, "Target=") == 0) { + check_Target = true ; + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int A = atoi(DataBuffer.c_str()); + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int Z = atoi(DataBuffer.c_str()); + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int EXX = atoi(DataBuffer.c_str())*MeV; + + G4ParticleDefinition* ParticleBuffer = G4ParticleTable::GetParticleTable()->GetIon(Z, A, EXX) ; + TargetParticle = ParticleBuffer ; + + G4cout << "Target : A=" << A << " Z=" << Z << " Excitation Energy = " << EXX/MeV << "MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { + check_BeamEnergy = true ; + ReactionFile >> DataBuffer; + BeamEnergy = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { + check_BeamEnergySpread = true ; + ReactionFile >> DataBuffer; + BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy Spread " << BeamEnergySpread / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { + check_FWHMX = true ; + ReactionFile >> DataBuffer; + SigmaX = atof(DataBuffer.c_str()) * mm; + G4cout << "Beam FWHM X " << SigmaX << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { + check_FWHMY = true ; + ReactionFile >> DataBuffer; + SigmaY = atof(DataBuffer.c_str()) * mm; + G4cout << "Beam FWHM Y " << SigmaX << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 19, "SigmaThetaX=") == 0) { + check_EmmitanceTheta = true ; + ReactionFile >> DataBuffer; + SigmaThetaX = atof(DataBuffer.c_str()) * deg; + G4cout << "Beam Emmitance Theta " << SigmaThetaX / deg << " deg" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "SigmaPhiY=") == 0) { + check_EmmitancePhi = true ; + ReactionFile >> DataBuffer; + SigmaPhiY = atof(DataBuffer.c_str()) * deg; + G4cout << "Beam Emmitance Phi " << SigmaPhiY / deg << " deg" << G4endl; + } + + else if (DataBuffer.compare(0, 13, "DecayProduct=") == 0) { + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int A = atoi(DataBuffer.c_str()); + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int Z = atoi(DataBuffer.c_str()); + ReactionFile >> DataBuffer; ReactionFile >> DataBuffer; + int EXX = atoi(DataBuffer.c_str())*MeV; + + G4ParticleDefinition* ParticleBuffer ; + + if ( A==1 && Z==0 ) + ParticleBuffer = G4ParticleTable::GetParticleTable()->FindParticle("neutron"); + else if ( A==1 && Z==1) + ParticleBuffer = G4ParticleTable::GetParticleTable()->FindParticle("proton"); +// else if ( A==2 && Z==0) +// ParticleBuffer = G4ParticleTable::GetParticleTable()->FindParticle("neutron"); +// ParticleBuffer->SetPDGMass( ParticleBuffer->GetPDGMass*2); + else + ParticleBuffer = G4ParticleTable::GetParticleTable()->GetIon(Z, A, EXX) ; + + ReactionProducts.push_back(ParticleBuffer); + + G4cout << "Decay Product: A=" << A << " Z=" << Z << " Excitation Energy = " << EXX/MeV << "MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 21, "EndOfDecayProductList") == 0) { + check_ReactionProducts = true ; + } + + + /////////////////////////////////////////////////// + // If no Transfert Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if( check_Beam && check_Target && check_BeamEnergy && check_BeamEnergySpread && check_FWHMX && check_FWHMY && check_EmmitanceTheta + && check_EmmitancePhi && check_ReactionProducts) + ReadingStatus = false ; + + } + + + } - SetEverything( BeamParticle , - TargetParticle , - ReactionProducts , - BeamEnergy , - BeamEnergySpread , - SigmaX , - SigmaY , - SigmaThetaX , - SigmaPhiY ); - - ReactionFile.close(); + SetEverything( BeamParticle, + TargetParticle, + ReactionProducts, + BeamEnergy, + BeamEnergySpread, + SigmaX, + SigmaY, + SigmaThetaX, + SigmaPhiY); + + ReactionFile.close(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EventGeneratorPhaseSpace::GenerateEvent(G4Event* anEvent , G4ParticleGun* particleGun) { - // If first time, write the DeDx table - if(anEvent->GetEventID()==0 && m_Target!=0) - { - m_Target->WriteDEDXTable(m_BeamParticle ,0, m_BeamEnergy+4*m_BeamEnergySpread); - for(unsigned int k = 0 ; k < m_ReactionProducts.size() ; k++) - { - m_Target->WriteDEDXTable(m_ReactionProducts[k] ,0, m_BeamEnergy+4*m_BeamEnergySpread); - } - } + // If first time, write the DeDx table + if(anEvent->GetEventID()==0 && m_Target!=0) + { + m_Target->WriteDEDXTable(m_BeamParticle ,0, m_BeamEnergy+4*m_BeamEnergySpread); + for(unsigned int k = 0 ; k < m_ReactionProducts.size() ; k++) + { + m_Target->WriteDEDXTable(m_ReactionProducts[k] ,0, m_BeamEnergy+4*m_BeamEnergySpread); + } + } // Clear contents of Precedent event (now stored in ROOTOutput) - m_InitConditions->Clear() ; - m_EventWeight = 0 ; - - /////////////////////////////////////////////////////////////////////// + m_InitConditions->Clear() ; + m_EventWeight = 0 ; + + /////////////////////////////////////////////////////////////////////// ///// Calculate the incident beam direction as well as the vertex ///// ///// of interaction in target and Energy Loss of the beam within ///// ///// the target. ///// @@ -322,15 +322,15 @@ void EventGeneratorPhaseSpace::GenerateEvent(G4Event* anEvent , G4ParticleGun* p G4double FinalBeamEnergy = 0 ; G4double InitialBeamEnergy = RandGauss::shoot(m_BeamEnergy, m_BeamEnergySpread); - m_Target->CalculateBeamInteraction( 0, m_SigmaX, 0, m_SigmaThetaX, - 0, m_SigmaY, 0, m_SigmaPhiY, - InitialBeamEnergy, - m_BeamParticle, - InterCoord, Beam_thetaX, Beam_phiY, - Beam_theta, Beam_phi, - FinalBeamEnergy); - - m_InitConditions->SetICIncidentEnergy(FinalBeamEnergy / MeV); + m_Target->CalculateBeamInteraction( 0, m_SigmaX, 0, m_SigmaThetaX, + 0, m_SigmaY, 0, m_SigmaPhiY, + InitialBeamEnergy, + m_BeamParticle, + InterCoord, Beam_thetaX, Beam_phiY, + Beam_theta, Beam_phi, + FinalBeamEnergy); + + m_InitConditions->SetICIncidentEnergy(FinalBeamEnergy / MeV); // write vertex position to ROOT file G4double x0 = InterCoord.x(); @@ -352,86 +352,86 @@ void EventGeneratorPhaseSpace::GenerateEvent(G4Event* anEvent , G4ParticleGun* p //////////////// Phase Space Calculation ///////////////// ////////////////////////////////////////////////////////// - // Masses array of ecay products in GeV (unit used by ROOT) - int NumberOfReactionProducts = m_ReactionProducts.size() ; - double* masses = new double[NumberOfReactionProducts]; - - for(int k = 0 ; k < NumberOfReactionProducts ; k++ ) - { - masses[k] = m_ReactionProducts[k]-> GetPDGMass()/GeV ; - } + // Masses array of ecay products in GeV (unit used by ROOT) + int NumberOfReactionProducts = m_ReactionProducts.size() ; + double* masses = new double[NumberOfReactionProducts]; + + for(int k = 0 ; k < NumberOfReactionProducts ; k++ ) + { + masses[k] = m_ReactionProducts[k]-> GetPDGMass()/GeV ; + } - // Kinematics of reaction - G4double M = m_BeamParticle -> GetPDGMass() ; - G4double InitialE = FinalBeamEnergy + M ; - G4double InitialMomentumX = sqrt( InitialE*InitialE - M*M) * sin(Beam_theta) * cos(Beam_phi) ; - G4double InitialMomentumY = sqrt( InitialE*InitialE - M*M) * sin(Beam_theta) * sin(Beam_phi) ; - G4double InitialMomentumZ = sqrt( InitialE*InitialE - M*M) * cos(Beam_theta) ; - - TLorentzVector Initial = TLorentzVector(InitialMomentumX/GeV, InitialMomentumY/GeV, InitialMomentumZ/GeV,InitialE/GeV) + TLorentzVector(0,0,0,m_TargetParticle -> GetPDGMass() / GeV); - - - // Instentiate a Phase Space Generator, with flat distrution - TGenPhaseSpace TPhaseSpace ; - - if( !TPhaseSpace.SetDecay(Initial, NumberOfReactionProducts , masses) ) cout << "Warning: Phase Space Decay forbiden by kinematic, or more than 18 particles "<<endl; - - // Generate event and store the associate weight. Think to use this weigt to get correcte spectrum - m_EventWeight = TPhaseSpace.Generate() ; - - - TLorentzVector* ProductLV ; - for ( int u = 0; u < NumberOfReactionProducts ; u++) - { - ProductLV = TPhaseSpace.GetDecay(u); - - G4ThreeVector Momentum ( ProductLV->X()*GeV , - ProductLV->Y()*GeV , - ProductLV->Z()*GeV ); - Momentum.unit() ; - - G4double Energy = ProductLV->E()*GeV-masses[u]*GeV ; - - //Set the gun to shoot - particleGun->SetParticleDefinition(m_ReactionProducts[u]) ; - particleGun->SetParticleMomentumDirection(Momentum) ; - particleGun->SetParticleEnergy(Energy) ; - particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)) ; - // Shoot the Daugter - particleGun->GeneratePrimaryVertex(anEvent) ; - - // get theta and phi in the world frame - G4double theta_world = Momentum.theta(); - G4double phi_world = Momentum.phi(); - if (phi_world < 1e-6) phi_world += 2*pi; - // write angles in ROOT file - m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); - m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); - m_InitConditions->SetICEmittedEnergy(Energy); - - } + // Kinematics of reaction + G4double M = m_BeamParticle -> GetPDGMass(); + G4double InitialE = FinalBeamEnergy + M ; + G4double InitialMomentumX = sqrt( InitialE*InitialE - M*M) * sin(Beam_theta) * cos(Beam_phi); + G4double InitialMomentumY = sqrt( InitialE*InitialE - M*M) * sin(Beam_theta) * sin(Beam_phi); + G4double InitialMomentumZ = sqrt( InitialE*InitialE - M*M) * cos(Beam_theta); + + TLorentzVector Initial = TLorentzVector(InitialMomentumX/GeV, InitialMomentumY/GeV, InitialMomentumZ/GeV,InitialE/GeV) + TLorentzVector(0,0,0,m_TargetParticle -> GetPDGMass() / GeV); + + + // Instentiate a Phase Space Generator, with flat distrution + TGenPhaseSpace TPhaseSpace ; + + if( !TPhaseSpace.SetDecay(Initial, NumberOfReactionProducts , masses) ) cout << "Warning: Phase Space Decay forbiden by kinematic, or more than 18 particles "<<endl; + + // Generate event and store the associate weight. Think to use this weigt to get correcte spectrum + m_EventWeight = TPhaseSpace.Generate(); + + + TLorentzVector* ProductLV ; + for ( int u = 0; u < NumberOfReactionProducts ; u++) + { + ProductLV = TPhaseSpace.GetDecay(u); + + G4ThreeVector Momentum ( ProductLV->X()*GeV , + ProductLV->Y()*GeV , + ProductLV->Z()*GeV ); + Momentum.unit() ; + + G4double Energy = ProductLV->E()*GeV-masses[u]*GeV ; + + //Set the gun to shoot + particleGun->SetParticleDefinition(m_ReactionProducts[u]); + particleGun->SetParticleMomentumDirection(Momentum); + particleGun->SetParticleEnergy(Energy); + particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)); + // Shoot the Daugter + particleGun->GeneratePrimaryVertex(anEvent) ; + + // get theta and phi in the world frame + G4double theta_world = Momentum.theta(); + G4double phi_world = Momentum.phi(); + if (phi_world < 1e-6) phi_world += 2*pi; + // write angles in ROOT file + m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); + m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); + m_InitConditions->SetICEmittedEnergy(Energy); + + } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void EventGeneratorPhaseSpace::SetEverything( G4ParticleDefinition* BeamParticle , - G4ParticleDefinition* TargetParticle , - vector<G4ParticleDefinition*> ReactionProducts , - double BeamEnergy , - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY ) +void EventGeneratorPhaseSpace::SetEverything( G4ParticleDefinition* BeamParticle, + G4ParticleDefinition* TargetParticle, + vector<G4ParticleDefinition*> ReactionProducts, + double BeamEnergy, + double BeamEnergySpread, + double SigmaX, + double SigmaY, + double SigmaThetaX, + double SigmaPhiY) { //------------- Constructor with nuclei names and beam energy ------------ - m_BeamParticle = BeamParticle ; - m_TargetParticle = TargetParticle ; - m_ReactionProducts = ReactionProducts ; - m_BeamEnergy = BeamEnergy ; - m_BeamEnergySpread = BeamEnergySpread ; - m_SigmaX = SigmaX ; - m_SigmaY = SigmaY ; - m_SigmaThetaX = SigmaThetaX ; - m_SigmaPhiY = SigmaPhiY ; + m_BeamParticle = BeamParticle; + m_TargetParticle = TargetParticle; + m_ReactionProducts = ReactionProducts; + m_BeamEnergy = BeamEnergy; + m_BeamEnergySpread = BeamEnergySpread; + m_SigmaX = SigmaX; + m_SigmaY = SigmaY; + m_SigmaThetaX = SigmaThetaX; + m_SigmaPhiY = SigmaPhiY; } diff --git a/NPSimulation/src/EventGeneratorTransfert.cc b/NPSimulation/src/EventGeneratorTransfert.cc index c19188bf9..517e6bb73 100644 --- a/NPSimulation/src/EventGeneratorTransfert.cc +++ b/NPSimulation/src/EventGeneratorTransfert.cc @@ -51,18 +51,18 @@ using namespace CLHEP; EventGeneratorTransfert::EventGeneratorTransfert() { //------------- Default Constructor ------------- - m_InitConditions = new TInitialConditions(); - m_Reaction = new Reaction(); - m_Target = 0; - - m_BeamEnergy = 0; - m_BeamEnergySpread = 0; - m_SigmaX = 0; - m_SigmaY = 0; - m_SigmaThetaX = 0; - m_SigmaPhiY = 0; - m_ShootLight = 0; - m_ShootHeavy = 0; + m_InitConditions = new TInitialConditions(); + m_Reaction = new Reaction(); + m_Target = 0; + + m_BeamEnergy = 0; + m_BeamEnergySpread = 0; + m_SigmaX = 0; + m_SigmaY = 0; + m_SigmaThetaX = 0; + m_SigmaPhiY = 0; + m_ShootLight = 0; + m_ShootHeavy = 0; } @@ -84,37 +84,37 @@ EventGeneratorTransfert::~EventGeneratorTransfert() } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -EventGeneratorTransfert::EventGeneratorTransfert(string name1 , // Beam nuclei - string name2 , // Target nuclei - string name3 , // Product of reaction - string name4 , // Product of reaction - double BeamEnergy , // Beam Energy - double ExcitationEnergyLight , // Excitation of Light Nuclei - double ExcitationEnergyHeavy , // Excitation of Heavy Nuclei - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY , - bool ShootLight , - bool ShootHeavy , - string Path) // Path of the differentiel Cross Section +EventGeneratorTransfert::EventGeneratorTransfert( string name1 , // Beam nuclei + string name2 , // Target nuclei + string name3 , // Product of reaction + string name4 , // Product of reaction + double BeamEnergy , // Beam Energy + double ExcitationEnergyLight , // Excitation of Light Nuclei + double ExcitationEnergyHeavy , // Excitation of Heavy Nuclei + double BeamEnergySpread , + double SigmaX , + double SigmaY , + double SigmaThetaX , + double SigmaPhiY , + bool ShootLight , + bool ShootHeavy , + string Path ) // Path of the differentiel Cross Section { - SetEverything( name1 , // Beam nuclei - name2 , // Target nuclei - name3 , // Product of reaction - name4 , // Product of reaction - BeamEnergy , // Beam Energy - ExcitationEnergyLight , // Excitation of Light Nuclei - ExcitationEnergyHeavy , // Excitation of Heavy Nuclei - BeamEnergySpread , - SigmaX , - SigmaY , - SigmaThetaX , - SigmaPhiY , - ShootLight , - ShootHeavy , - Path); + SetEverything( name1, + name2, + name3, + name4, + BeamEnergy, + ExcitationEnergyLight, + ExcitationEnergyHeavy, + BeamEnergySpread, + SigmaX, + SigmaY, + SigmaThetaX, + SigmaPhiY, + ShootLight, + ShootHeavy, + Path); } @@ -149,8 +149,8 @@ void EventGeneratorTransfert::ReadConfiguration(string Path) string Beam, Target, Heavy, Light, CrossSectionPath ; G4double BeamEnergy = 0 , ExcitationEnergyLight = 0, ExcitationEnergyHeavy = 0; G4double BeamEnergySpread = 0 , SigmaX = 0 , SigmaY = 0 , SigmaThetaX = 0 , SigmaPhiY=0; - bool ShootLight = false ; - bool ShootHeavy = false ; + bool ShootLight = false ; + bool ShootHeavy = false ; bool ReadingStatus = false ; bool check_Beam = false ; @@ -186,159 +186,159 @@ void EventGeneratorTransfert::ReadConfiguration(string Path) if (LineBuffer.compare(0, 9, "Transfert") == 0) { ReadingStatus = true ;} -while(ReadingStatus){ - - ReactionFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - else if (DataBuffer.compare(0, 5, "Beam=") == 0) { - check_Beam = true ; - ReactionFile >> DataBuffer; - Beam = DataBuffer; - G4cout << "Beam " << Beam << G4endl; - } - - else if (DataBuffer.compare(0, 7, "Target=") == 0) { - check_Target = true ; - ReactionFile >> DataBuffer; - Target = DataBuffer; - G4cout << "Target " << Target << G4endl; - } - - else if (DataBuffer.compare(0, 6, "Light=") == 0) { - check_Light = true ; - ReactionFile >> DataBuffer; - Light = DataBuffer; - G4cout << "Light " << Light << G4endl; - } - - else if (DataBuffer.compare(0, 6, "Heavy=") == 0) { - check_Heavy = true ; - ReactionFile >> DataBuffer; - Heavy = DataBuffer; - G4cout << "Heavy " << Heavy << G4endl; - } - - else if (DataBuffer.compare(0, 22, "ExcitationEnergyLight=") == 0) { - check_ExcitationEnergyLight = true ; - ReactionFile >> DataBuffer; - ExcitationEnergyLight = atof(DataBuffer.c_str()) * MeV; - G4cout << "Excitation Energy Light" << ExcitationEnergyLight / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 22, "ExcitationEnergyHeavy=") == 0) { - check_ExcitationEnergyHeavy = true ; - ReactionFile >> DataBuffer; - ExcitationEnergyHeavy = atof(DataBuffer.c_str()) * MeV; - G4cout << "Excitation Energy Heavy" << ExcitationEnergyHeavy / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { - check_BeamEnergy = true ; - ReactionFile >> DataBuffer; - BeamEnergy = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { - check_BeamEnergySpread = true ; - ReactionFile >> DataBuffer; - BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy Spread " << BeamEnergySpread / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { - check_FWHMX = true ; - ReactionFile >> DataBuffer; - SigmaX = atof(DataBuffer.c_str()) * mm; - G4cout << "Beam FWHM X " << SigmaX << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { - check_FWHMY = true ; - ReactionFile >> DataBuffer; - SigmaY = atof(DataBuffer.c_str()) * mm; - G4cout << "Beam FWHM Y " << SigmaX << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 12, "SigmaThetaX=") == 0) { - check_EmmitanceTheta = true ; - ReactionFile >> DataBuffer; - SigmaThetaX = atof(DataBuffer.c_str()) * deg; - G4cout << "Beam Emmitance Theta " << SigmaThetaX / deg << " deg" << G4endl; - } - - else if (DataBuffer.compare(0, 10, "SigmaPhiY=") == 0) { - check_EmmitancePhi = true ; - ReactionFile >> DataBuffer; - SigmaPhiY = atof(DataBuffer.c_str()) * deg; - G4cout << "Beam Emmitance Phi " << SigmaPhiY / deg << " deg" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "CrossSectionPath=") == 0) { - check_CrossSectionPath = true ; - ReactionFile >> CrossSectionPath; - G4cout << "Cross Section File: " << CrossSectionPath << G4endl ; - } - - else if (DataBuffer.compare(0, 11, "ShootLight=") == 0) { - check_ShootLight = true ; - ReactionFile >> DataBuffer; - if (atof(DataBuffer.c_str()) == 1) ShootLight = true ; - if (ShootLight) G4cout << "Shoot Light particle : yes" << G4endl; - else G4cout << "Shoot Light particle : no" << G4endl; - } - - else if (DataBuffer.compare(0, 11, "ShootHeavy=") == 0) { - check_ShootHeavy = true ; - ReactionFile >> DataBuffer; - if (atof(DataBuffer.c_str()) == 1) ShootHeavy = true ; - if (ShootHeavy) G4cout << "Shoot Heavy particle : yes" << G4endl; - else G4cout << "Shoot Heavy particle : no" << G4endl; - } - - - /////////////////////////////////////////////////// - // If no Transfert Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if(check_Beam && check_Target && check_Light && check_Heavy && check_ExcitationEnergyLight && check_ExcitationEnergyHeavy - && check_BeamEnergy && check_BeamEnergySpread && check_FWHMX && check_FWHMY && check_EmmitanceTheta - && check_EmmitancePhi && check_CrossSectionPath && check_ShootLight && check_ShootHeavy) - ReadingStatus = false ; - - } - - - } + while(ReadingStatus){ + + ReactionFile >> DataBuffer; + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + else if (DataBuffer.compare(0, 5, "Beam=") == 0) { + check_Beam = true ; + ReactionFile >> DataBuffer; + Beam = DataBuffer; + G4cout << "Beam " << Beam << G4endl; + } + + else if (DataBuffer.compare(0, 7, "Target=") == 0) { + check_Target = true ; + ReactionFile >> DataBuffer; + Target = DataBuffer; + G4cout << "Target " << Target << G4endl; + } + + else if (DataBuffer.compare(0, 6, "Light=") == 0) { + check_Light = true ; + ReactionFile >> DataBuffer; + Light = DataBuffer; + G4cout << "Light " << Light << G4endl; + } + + else if (DataBuffer.compare(0, 6, "Heavy=") == 0) { + check_Heavy = true ; + ReactionFile >> DataBuffer; + Heavy = DataBuffer; + G4cout << "Heavy " << Heavy << G4endl; + } + + else if (DataBuffer.compare(0, 22, "ExcitationEnergyLight=") == 0) { + check_ExcitationEnergyLight = true ; + ReactionFile >> DataBuffer; + ExcitationEnergyLight = atof(DataBuffer.c_str()) * MeV; + G4cout << "Excitation Energy Light" << ExcitationEnergyLight / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 22, "ExcitationEnergyHeavy=") == 0) { + check_ExcitationEnergyHeavy = true ; + ReactionFile >> DataBuffer; + ExcitationEnergyHeavy = atof(DataBuffer.c_str()) * MeV; + G4cout << "Excitation Energy Heavy" << ExcitationEnergyHeavy / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { + check_BeamEnergy = true ; + ReactionFile >> DataBuffer; + BeamEnergy = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { + check_BeamEnergySpread = true ; + ReactionFile >> DataBuffer; + BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy Spread " << BeamEnergySpread / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { + check_FWHMX = true ; + ReactionFile >> DataBuffer; + SigmaX = atof(DataBuffer.c_str()) * mm; + G4cout << "Beam FWHM X " << SigmaX << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { + check_FWHMY = true ; + ReactionFile >> DataBuffer; + SigmaY = atof(DataBuffer.c_str()) * mm; + G4cout << "Beam FWHM Y " << SigmaX << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 12, "SigmaThetaX=") == 0) { + check_EmmitanceTheta = true ; + ReactionFile >> DataBuffer; + SigmaThetaX = atof(DataBuffer.c_str()) * deg; + G4cout << "Beam Emmitance Theta " << SigmaThetaX / deg << " deg" << G4endl; + } + + else if (DataBuffer.compare(0, 10, "SigmaPhiY=") == 0) { + check_EmmitancePhi = true ; + ReactionFile >> DataBuffer; + SigmaPhiY = atof(DataBuffer.c_str()) * deg; + G4cout << "Beam Emmitance Phi " << SigmaPhiY / deg << " deg" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "CrossSectionPath=") == 0) { + check_CrossSectionPath = true ; + ReactionFile >> CrossSectionPath; + G4cout << "Cross Section File: " << CrossSectionPath << G4endl ; + } + + else if (DataBuffer.compare(0, 11, "ShootLight=") == 0) { + check_ShootLight = true ; + ReactionFile >> DataBuffer; + if (atof(DataBuffer.c_str()) == 1) ShootLight = true ; + if (ShootLight) G4cout << "Shoot Light particle : yes" << G4endl; + else G4cout << "Shoot Light particle : no" << G4endl; + } + + else if (DataBuffer.compare(0, 11, "ShootHeavy=") == 0) { + check_ShootHeavy = true ; + ReactionFile >> DataBuffer; + if (atof(DataBuffer.c_str()) == 1) ShootHeavy = true ; + if (ShootHeavy) G4cout << "Shoot Heavy particle : yes" << G4endl; + else G4cout << "Shoot Heavy particle : no" << G4endl; + } + + + /////////////////////////////////////////////////// + // If no Transfert Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if(check_Beam && check_Target && check_Light && check_Heavy && check_ExcitationEnergyLight && check_ExcitationEnergyHeavy + && check_BeamEnergy && check_BeamEnergySpread && check_FWHMX && check_FWHMY && check_EmmitanceTheta + && check_EmmitancePhi && check_CrossSectionPath && check_ShootLight && check_ShootHeavy) + ReadingStatus = false ; + + } + + + } - SetEverything(Beam , - Target , - Light , - Heavy , - BeamEnergy , - ExcitationEnergyLight , - ExcitationEnergyHeavy , - BeamEnergySpread , - SigmaX , - SigmaY , - SigmaThetaX , - SigmaPhiY , - ShootLight , - ShootHeavy , - CrossSectionPath); + SetEverything( Beam, + Target, + Light, + Heavy, + BeamEnergy, + ExcitationEnergyLight, + ExcitationEnergyHeavy, + BeamEnergySpread, + SigmaX, + SigmaY, + SigmaThetaX, + SigmaPhiY, + ShootLight, + ShootHeavy, + CrossSectionPath); - ReactionFile.close(); + ReactionFile.close(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EventGeneratorTransfert::GenerateEvent(G4Event* anEvent , G4ParticleGun* particleGun) -{ +{ // If first time, write the DeDx table if (anEvent->GetEventID() == 0) { //-------------- Before living, wrtie the DeDx Table ------------------- @@ -350,7 +350,7 @@ void EventGeneratorTransfert::GenerateEvent(G4Event* anEvent , G4ParticleGun* pa if (m_Target != 0) { m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(LightZx,LightAx, 0.) ,0, m_BeamEnergy+4*m_BeamEnergySpread); - m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(BeamZx,BeamAx, 0.) ,0, m_BeamEnergy+4*m_BeamEnergySpread); + m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(BeamZx,BeamAx, 0.) ,0, m_BeamEnergy+4*m_BeamEnergySpread); } } @@ -391,14 +391,14 @@ void EventGeneratorTransfert::GenerateEvent(G4Event* anEvent , G4ParticleGun* pa G4double FinalBeamEnergy = 0 ; G4double InitialBeamEnergy = RandGauss::shoot(m_BeamEnergy, m_BeamEnergySpread); - m_Target->CalculateBeamInteraction(0, m_SigmaX, 0, m_SigmaThetaX, - 0, m_SigmaY, 0, m_SigmaPhiY, - InitialBeamEnergy, - BeamName, - InterCoord, Beam_thetaX, Beam_phiY, - Beam_theta, Beam_phi, - FinalBeamEnergy); - + m_Target->CalculateBeamInteraction( 0, m_SigmaX, 0, m_SigmaThetaX, + 0, m_SigmaY, 0, m_SigmaPhiY, + InitialBeamEnergy, + BeamName, + InterCoord, Beam_thetaX, Beam_phiY, + Beam_theta, Beam_phi, + FinalBeamEnergy); + m_Reaction->SetBeamEnergy(FinalBeamEnergy); m_InitConditions->SetICIncidentEnergy(FinalBeamEnergy / MeV); @@ -523,13 +523,13 @@ void EventGeneratorTransfert::GenerateEvent(G4Event* anEvent , G4ParticleGun* pa //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void EventGeneratorTransfert::SetEverything(string name1, // Beam nuclei - string name2, // Target nuclei - string name3, // Product of reaction - string name4, // Product of reaction - double BeamEnergy, // Beam Energy - double ExcitationEnergyLight, // Excitation of Light Nuclei - double ExcitationEnergyHeavy, // Excitation of Heavy Nuclei +void EventGeneratorTransfert::SetEverything(string name1, // Beam nuclei + string name2, // Target nuclei + string name3, // Product of reaction + string name4, // Product of reaction + double BeamEnergy, // Beam Energy + double ExcitationEnergyLight,// Excitation of Light Nuclei + double ExcitationEnergyHeavy,// Excitation of Heavy Nuclei double BeamEnergySpread, double SigmaX, double SigmaY, @@ -539,8 +539,8 @@ void EventGeneratorTransfert::SetEverything(string name1, // Beam nuclei bool ShootHeavy, string Path) { - m_Reaction = new Reaction(name1, name2, name3, name4, BeamEnergy, ExcitationEnergyLight, ExcitationEnergyHeavy, Path); - + m_Reaction = new Reaction(name1, name2, name3, name4, BeamEnergy, ExcitationEnergyLight, ExcitationEnergyHeavy, Path); + m_BeamEnergy = BeamEnergy; m_BeamEnergySpread = BeamEnergySpread; m_SigmaX = SigmaX; diff --git a/NPSimulation/src/EventGeneratorTransfertToResonance.cc b/NPSimulation/src/EventGeneratorTransfertToResonance.cc index 7094ad899..c03be291d 100644 --- a/NPSimulation/src/EventGeneratorTransfertToResonance.cc +++ b/NPSimulation/src/EventGeneratorTransfertToResonance.cc @@ -15,12 +15,12 @@ * This event Generator is used to simulated two body TransfertReaction. * * A Phase Space calculation is then performed to decay the Heavy product. * * The TGenPhaseSpace from ROOT is used to calculate a phase space decay * - * with flat distribution * + * with flat distribution * *---------------------------------------------------------------------------* * Comment: * * + 20/01/2011: Add support for excitation energy for light ejectile * * (N. de Sereville) * - * * + * * * * *****************************************************************************/ @@ -58,75 +58,75 @@ using namespace CLHEP; EventGeneratorTransfertToResonance::EventGeneratorTransfertToResonance() { //------------- Default Constructor ------------- - m_InitConditions = new TInitialConditions() ; - m_Reaction = new Reaction() ; - m_Target = new Target() ; - m_SigmaX = 0 ; - m_SigmaY = 0 ; - m_SigmaThetaX = 0 ; - m_SigmaPhiY = 0 ; - m_ResonanceDecayZ = 0 ; - m_ResonanceDecayA = 0 ; - m_EventWeight = 0 ; + m_InitConditions = new TInitialConditions(); + m_Reaction = new Reaction(); + m_Target = new Target(); + m_SigmaX = 0; + m_SigmaY = 0; + m_SigmaThetaX = 0; + m_SigmaPhiY = 0; + m_ResonanceDecayZ = 0; + m_ResonanceDecayA = 0; + m_EventWeight = 0; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... EventGeneratorTransfertToResonance::~EventGeneratorTransfertToResonance() { //------------- Default Destructor ------------ - delete m_InitConditions ; - delete m_Reaction ; + delete m_InitConditions; + delete m_Reaction; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void EventGeneratorTransfertToResonance::SetTarget(Target* Target) +void EventGeneratorTransfertToResonance::SetTarget(Target* Target) { - if(Target!=0) - m_Target = Target; + if(Target!=0) + m_Target = Target; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -EventGeneratorTransfertToResonance::EventGeneratorTransfertToResonance( string name1 , - string name2 , - string name3 , - string name4 , - double BeamEnergy , - double ExcitationEnergyLight , - double ExcitationEnergyHeavy , - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY , - double ResonanceWidth, - int ResonanceDecayZ , - int ResonanceDecayA , - bool ShootLight , - bool ShootHeavy , - bool ShootDecayProduct , - string Path ) +EventGeneratorTransfertToResonance::EventGeneratorTransfertToResonance( string name1, + string name2, + string name3, + string name4, + double BeamEnergy, + double ExcitationEnergyLight, + double ExcitationEnergyHeavy, + double BeamEnergySpread, + double SigmaX, + double SigmaY, + double SigmaThetaX, + double SigmaPhiY, + double ResonanceWidth, + int ResonanceDecayZ, + int ResonanceDecayA, + bool ShootLight, + bool ShootHeavy, + bool ShootDecayProduct, + string Path) { //------------- Constructor with nuclei names and beam energy ------------ - SetEverything( name1 , //Beam nuclei - name2 , //Target nuclei - name3 , //Product of reaction - name4 , //Product of reaction - BeamEnergy , //Beam Energy - ExcitationEnergyLight , //Excitation of Heavy Nuclei - ExcitationEnergyHeavy , //Excitation of Heavy Nuclei - BeamEnergySpread , - SigmaX , - SigmaY , - SigmaThetaX , - SigmaPhiY , - ResonanceWidth , - ResonanceDecayZ , - ResonanceDecayA , - ShootLight , - ShootHeavy , - ShootDecayProduct , - Path ); - - m_EventWeight = 0 ; + SetEverything( name1, + name2, + name3, + name4, + BeamEnergy, + ExcitationEnergyLight, + ExcitationEnergyHeavy, + BeamEnergySpread, + SigmaX, + SigmaY, + SigmaThetaX, + SigmaPhiY, + ResonanceWidth, + ResonanceDecayZ, + ResonanceDecayA, + ShootLight, + ShootHeavy, + ShootDecayProduct, + Path); + + m_EventWeight = 0; } @@ -153,8 +153,8 @@ void EventGeneratorTransfertToResonance::ReadConfiguration(string Path) string Beam, Target, Heavy, Light, CrossSectionPath ; G4double BeamEnergy = 0, ExcitationEnergyLight = 0, ExcitationEnergyHeavy = 0; G4double BeamEnergySpread = 0 , SigmaX = 0 , SigmaY = 0 , SigmaThetaX = 0 , SigmaPhiY=0, ResonanceWidth = 0 ,ResonanceDecayZ = 0 , ResonanceDecayA = 0 ; - bool ShootLight = false ; - bool ShootHeavy = false ; + bool ShootLight = false ; + bool ShootHeavy = false ; bool ShootDecayProduct = false ; bool ReadingStatus = false ; @@ -195,214 +195,214 @@ void EventGeneratorTransfertToResonance::ReadConfiguration(string Path) if (LineBuffer.compare(0, 20, "TransfertToResonance") == 0) { ReadingStatus = true ;} -while(ReadingStatus){ - - ReactionFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - else if (DataBuffer.compare(0, 5, "Beam=") == 0) { - check_Beam = true ; - ReactionFile >> DataBuffer; - Beam = DataBuffer; - G4cout << "Beam " << Beam << G4endl; - } - - else if (DataBuffer.compare(0, 7, "Target=") == 0) { - check_Target = true ; - ReactionFile >> DataBuffer; - Target = DataBuffer; - G4cout << "Target " << Target << G4endl; - } - - else if (DataBuffer.compare(0, 6, "Light=") == 0) { - check_Light = true ; - ReactionFile >> DataBuffer; - Light = DataBuffer; - G4cout << "Light " << Light << G4endl; - } - - else if (DataBuffer.compare(0, 6, "Heavy=") == 0) { - check_Heavy = true ; - ReactionFile >> DataBuffer; - Heavy = DataBuffer; - G4cout << "Heavy " << Heavy << G4endl; - } - - else if (DataBuffer.compare(0, 22, "ExcitationEnergyLight=") == 0) { - check_ExcitationEnergyLight = true ; - ReactionFile >> DataBuffer; - ExcitationEnergyLight = atof(DataBuffer.c_str()) * MeV; - G4cout << "Excitation Energy Light " << ExcitationEnergyLight / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 22, "ExcitationEnergyHeavy=") == 0) { - check_ExcitationEnergyHeavy = true ; - ReactionFile >> DataBuffer; - ExcitationEnergyHeavy = atof(DataBuffer.c_str()) * MeV; - G4cout << "Excitation Energy Heavy " << ExcitationEnergyHeavy / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { - check_BeamEnergy = true ; - ReactionFile >> DataBuffer; - BeamEnergy = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { - check_BeamEnergySpread = true ; - ReactionFile >> DataBuffer; - BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; - G4cout << "Beam Energy Spread " << BeamEnergySpread / MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { - check_FWHMX = true ; - ReactionFile >> DataBuffer; - SigmaX = atof(DataBuffer.c_str()) * mm; - G4cout << "Beam FWHM X " << SigmaX << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { - check_FWHMY = true ; - ReactionFile >> DataBuffer; - SigmaY = atof(DataBuffer.c_str()) * mm; - G4cout << "Beam FWHM Y " << SigmaX << " mm" << G4endl; - } - - else if (DataBuffer.compare(0, 19, "SigmaThetaX=") == 0) { - check_EmmitanceTheta = true ; - ReactionFile >> DataBuffer; - SigmaThetaX = atof(DataBuffer.c_str()) * deg; - G4cout << "Beam Emmitance Theta " << SigmaThetaX / deg << " deg" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "SigmaPhiY=") == 0) { - check_EmmitancePhi = true ; - ReactionFile >> DataBuffer; - SigmaPhiY = atof(DataBuffer.c_str()) * deg; - G4cout << "Beam Emmitance Phi " << SigmaPhiY / deg << " deg" << G4endl; - } - - else if (DataBuffer.compare(0, 15, "ResonanceWidth=") == 0) { - check_ResonanceWidth = true ; - ReactionFile >> DataBuffer; - ResonanceWidth = atof(DataBuffer.c_str())*MeV; - G4cout << "Resonance Width " << ResonanceWidth/MeV << " MeV" << G4endl; - } - - else if (DataBuffer.compare(0, 17, "ResonanceDecayZ=") == 0) { - check_ResonanceDecayZ = true ; - ReactionFile >> DataBuffer; - ResonanceDecayZ = atof(DataBuffer.c_str()); - G4cout << "ResonanceDecayZ " << ResonanceDecayZ << G4endl; - } - - else if (DataBuffer.compare(0, 17, "ResonanceDecayA=") == 0) { - check_ResonanceDecayA = true ; - ReactionFile >> DataBuffer; - ResonanceDecayA = atof(DataBuffer.c_str()); - G4cout << "ResonanceDecayA " << ResonanceDecayA << G4endl; - } - - else if (DataBuffer.compare(0, 17, "CrossSectionPath=") == 0) { - check_CrossSectionPath = true ; - ReactionFile >> CrossSectionPath; - G4cout << "Cross Section File: " << CrossSectionPath << G4endl ; - } - - else if (DataBuffer.compare(0, 11, "ShootLight=") == 0) { - check_ShootLight = true ; - ReactionFile >> DataBuffer; - if (atof(DataBuffer.c_str()) == 1) ShootLight = true ; - if (ShootLight) G4cout << "Shoot Light particle : yes" << G4endl; - else G4cout << "Shoot Light particle : no" << G4endl; - } - - else if (DataBuffer.compare(0, 11, "ShootHeavy=") == 0) { - check_ShootHeavy = true ; - ReactionFile >> DataBuffer; - if (atof(DataBuffer.c_str()) == 1) ShootHeavy = true ; - if (ShootHeavy) G4cout << "Shoot Heavy particle : yes" << G4endl; - else G4cout << "Shoot Heavy particle : no" << G4endl; - } - - else if (DataBuffer.compare(0, 18, "ShootDecayProduct=") == 0) { - check_ShootDecayProduct = true ; - ReactionFile >> DataBuffer; - if (atof(DataBuffer.c_str()) == 1) ShootDecayProduct = true ; - if (ShootDecayProduct) G4cout << "Shoot DecayProducts from decay : yes" << G4endl; - else G4cout << "Shoot DecayProducts from decay : no" << G4endl; - } - - - /////////////////////////////////////////////////// - // If no Transfert Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if (check_Beam && check_Target && check_Light && check_Heavy && check_ExcitationEnergyLight && check_ExcitationEnergyHeavy - && check_BeamEnergy && check_BeamEnergySpread && check_FWHMX && check_FWHMY && check_EmmitanceTheta - && check_EmmitancePhi && check_CrossSectionPath && check_ShootLight && check_ShootHeavy - && check_ResonanceWidth && check_ResonanceDecayZ && check_ResonanceDecayA && check_ShootDecayProduct) - ReadingStatus = false ; - - } - - - } + while(ReadingStatus){ + + ReactionFile >> DataBuffer; + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + else if (DataBuffer.compare(0, 5, "Beam=") == 0) { + check_Beam = true ; + ReactionFile >> DataBuffer; + Beam = DataBuffer; + G4cout << "Beam " << Beam << G4endl; + } + + else if (DataBuffer.compare(0, 7, "Target=") == 0) { + check_Target = true ; + ReactionFile >> DataBuffer; + Target = DataBuffer; + G4cout << "Target " << Target << G4endl; + } + + else if (DataBuffer.compare(0, 6, "Light=") == 0) { + check_Light = true ; + ReactionFile >> DataBuffer; + Light = DataBuffer; + G4cout << "Light " << Light << G4endl; + } + + else if (DataBuffer.compare(0, 6, "Heavy=") == 0) { + check_Heavy = true ; + ReactionFile >> DataBuffer; + Heavy = DataBuffer; + G4cout << "Heavy " << Heavy << G4endl; + } + + else if (DataBuffer.compare(0, 22, "ExcitationEnergyLight=") == 0) { + check_ExcitationEnergyLight = true ; + ReactionFile >> DataBuffer; + ExcitationEnergyLight = atof(DataBuffer.c_str()) * MeV; + G4cout << "Excitation Energy Light " << ExcitationEnergyLight / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 22, "ExcitationEnergyHeavy=") == 0) { + check_ExcitationEnergyHeavy = true ; + ReactionFile >> DataBuffer; + ExcitationEnergyHeavy = atof(DataBuffer.c_str()) * MeV; + G4cout << "Excitation Energy Heavy " << ExcitationEnergyHeavy / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 11, "BeamEnergy=") == 0) { + check_BeamEnergy = true ; + ReactionFile >> DataBuffer; + BeamEnergy = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "BeamEnergySpread=") == 0) { + check_BeamEnergySpread = true ; + ReactionFile >> DataBuffer; + BeamEnergySpread = atof(DataBuffer.c_str()) * MeV; + G4cout << "Beam Energy Spread " << BeamEnergySpread / MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 7, "SigmaX=") == 0) { + check_FWHMX = true ; + ReactionFile >> DataBuffer; + SigmaX = atof(DataBuffer.c_str()) * mm; + G4cout << "Beam FWHM X " << SigmaX << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 7, "SigmaY=") == 0) { + check_FWHMY = true ; + ReactionFile >> DataBuffer; + SigmaY = atof(DataBuffer.c_str()) * mm; + G4cout << "Beam FWHM Y " << SigmaX << " mm" << G4endl; + } + + else if (DataBuffer.compare(0, 19, "SigmaThetaX=") == 0) { + check_EmmitanceTheta = true ; + ReactionFile >> DataBuffer; + SigmaThetaX = atof(DataBuffer.c_str()) * deg; + G4cout << "Beam Emmitance Theta " << SigmaThetaX / deg << " deg" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "SigmaPhiY=") == 0) { + check_EmmitancePhi = true ; + ReactionFile >> DataBuffer; + SigmaPhiY = atof(DataBuffer.c_str()) * deg; + G4cout << "Beam Emmitance Phi " << SigmaPhiY / deg << " deg" << G4endl; + } + + else if (DataBuffer.compare(0, 15, "ResonanceWidth=") == 0) { + check_ResonanceWidth = true ; + ReactionFile >> DataBuffer; + ResonanceWidth = atof(DataBuffer.c_str())*MeV; + G4cout << "Resonance Width " << ResonanceWidth/MeV << " MeV" << G4endl; + } + + else if (DataBuffer.compare(0, 17, "ResonanceDecayZ=") == 0) { + check_ResonanceDecayZ = true ; + ReactionFile >> DataBuffer; + ResonanceDecayZ = atof(DataBuffer.c_str()); + G4cout << "ResonanceDecayZ " << ResonanceDecayZ << G4endl; + } + + else if (DataBuffer.compare(0, 17, "ResonanceDecayA=") == 0) { + check_ResonanceDecayA = true ; + ReactionFile >> DataBuffer; + ResonanceDecayA = atof(DataBuffer.c_str()); + G4cout << "ResonanceDecayA " << ResonanceDecayA << G4endl; + } + + else if (DataBuffer.compare(0, 17, "CrossSectionPath=") == 0) { + check_CrossSectionPath = true ; + ReactionFile >> CrossSectionPath; + G4cout << "Cross Section File: " << CrossSectionPath << G4endl ; + } + + else if (DataBuffer.compare(0, 11, "ShootLight=") == 0) { + check_ShootLight = true ; + ReactionFile >> DataBuffer; + if (atof(DataBuffer.c_str()) == 1) ShootLight = true ; + if (ShootLight) G4cout << "Shoot Light particle : yes" << G4endl; + else G4cout << "Shoot Light particle : no" << G4endl; + } + + else if (DataBuffer.compare(0, 11, "ShootHeavy=") == 0) { + check_ShootHeavy = true ; + ReactionFile >> DataBuffer; + if (atof(DataBuffer.c_str()) == 1) ShootHeavy = true ; + if (ShootHeavy) G4cout << "Shoot Heavy particle : yes" << G4endl; + else G4cout << "Shoot Heavy particle : no" << G4endl; + } + + else if (DataBuffer.compare(0, 18, "ShootDecayProduct=") == 0) { + check_ShootDecayProduct = true ; + ReactionFile >> DataBuffer; + if (atof(DataBuffer.c_str()) == 1) ShootDecayProduct = true ; + if (ShootDecayProduct) G4cout << "Shoot DecayProducts from decay : yes" << G4endl; + else G4cout << "Shoot DecayProducts from decay : no" << G4endl; + } + + + /////////////////////////////////////////////////// + // If no Transfert Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if (check_Beam && check_Target && check_Light && check_Heavy && check_ExcitationEnergyLight && check_ExcitationEnergyHeavy + && check_BeamEnergy && check_BeamEnergySpread && check_FWHMX && check_FWHMY && check_EmmitanceTheta + && check_EmmitancePhi && check_CrossSectionPath && check_ShootLight && check_ShootHeavy + && check_ResonanceWidth && check_ResonanceDecayZ && check_ResonanceDecayA && check_ShootDecayProduct) + ReadingStatus = false ; + + } + + + } - SetEverything( Beam , - Target , - Light , - Heavy , - BeamEnergy , - ExcitationEnergyLight , - ExcitationEnergyHeavy , - BeamEnergySpread , - SigmaX , - SigmaY , - SigmaThetaX , - SigmaPhiY , - ResonanceWidth , - ResonanceDecayZ , - ResonanceDecayA , - ShootLight , - ShootHeavy , - ShootDecayProduct , - CrossSectionPath ); - - ReactionFile.close(); + SetEverything( Beam, + Target, + Light, + Heavy, + BeamEnergy, + ExcitationEnergyLight, + ExcitationEnergyHeavy, + BeamEnergySpread, + SigmaX, + SigmaY, + SigmaThetaX, + SigmaPhiY, + ResonanceWidth, + ResonanceDecayZ, + ResonanceDecayA, + ShootLight, + ShootHeavy, + ShootDecayProduct, + CrossSectionPath); + + ReactionFile.close(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EventGeneratorTransfertToResonance::GenerateEvent(G4Event* anEvent , G4ParticleGun* particleGun) { - // Initialize event weight to one. - m_EventWeight = 1 ; - - // If first time, write the DeDx table - if(anEvent->GetEventID()==0) - { - //-------------- Before living, wrtie the DeDx Table ------------------- - - G4int LightZx = m_Reaction->GetNucleus3()->GetZ() ; - G4int LightAx = m_Reaction->GetNucleus3()->GetA() ; - - G4int BeamZx = m_Reaction->GetNucleus1()->GetZ() ; - G4int BeamAx = m_Reaction->GetNucleus1()->GetA() ; - - if(m_Target!=0) - { - m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(LightZx,LightAx, 0.) ,0, m_BeamEnergy+4*m_BeamEnergySpread); - m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(BeamZx,BeamAx, 0.) ,0, m_BeamEnergy+4*m_BeamEnergySpread); - } - - } + // Initialize event weight to one. + m_EventWeight = 1 ; + + // If first time, write the DeDx table + if(anEvent->GetEventID()==0) + { + //-------------- Before living, wrtie the DeDx Table ------------------- + + G4int LightZx = m_Reaction->GetNucleus3()->GetZ() ; + G4int LightAx = m_Reaction->GetNucleus3()->GetA() ; + + G4int BeamZx = m_Reaction->GetNucleus1()->GetZ() ; + G4int BeamAx = m_Reaction->GetNucleus1()->GetA() ; + + if(m_Target!=0) + { + m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(LightZx,LightAx, 0.) ,0, m_BeamEnergy+4*m_BeamEnergySpread); + m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(BeamZx,BeamAx, 0.) ,0, m_BeamEnergy+4*m_BeamEnergySpread); + } + + } // Clear contents of Precedent event (now stored in ROOTOutput) m_InitConditions->Clear(); @@ -417,24 +417,24 @@ void EventGeneratorTransfertToResonance::GenerateEvent(G4Event* anEvent , G4Part G4ParticleDefinition* LightName = G4ParticleTable::GetParticleTable()->GetIon(LightZ, LightA, 0.); - // Shoot the Resonance energy following the mean and width value - // EXX should always be more than specific heat of the reaction - // double EXX = RandBreitWigner::shoot(m_ResonanceMean,m_ResonanceWidth) ; - double EXX = RandGauss::shoot(m_ResonanceMean,m_ResonanceWidth) ; + // Shoot the Resonance energy following the mean and width value + // EXX should always be more than specific heat of the reaction + // double EXX = RandBreitWigner::shoot(m_ResonanceMean,m_ResonanceWidth) ; + double EXX = RandGauss::shoot(m_ResonanceMean,m_ResonanceWidth) ; m_Reaction->SetExcitationHeavy( EXX ); - while ( m_Reaction->CheckKinematic()==false ) - { -// EXX = RandBreitWigner::shoot(m_ResonanceMean,m_ResonanceWidth) ; - EXX = RandGauss::shoot(m_ResonanceMean,m_ResonanceWidth) ; - m_Reaction->SetExcitationHeavy( EXX ); - } + while ( m_Reaction->CheckKinematic()==false ) + { +// EXX = RandBreitWigner::shoot(m_ResonanceMean,m_ResonanceWidth) ; + EXX = RandGauss::shoot(m_ResonanceMean,m_ResonanceWidth) ; + m_Reaction->SetExcitationHeavy( EXX ); + } // Beam G4int BeamZ = m_Reaction->GetNucleus1()->GetZ(); G4int BeamA = m_Reaction->GetNucleus1()->GetA(); G4ParticleDefinition* BeamName = G4ParticleTable::GetParticleTable()->GetIon(BeamZ, BeamA, 0); - /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// ///// Calculate the incident beam direction as well as the vertex ///// ///// of interaction in target and Energy Loss of the beam within ///// ///// the target. ///// @@ -446,17 +446,16 @@ void EventGeneratorTransfertToResonance::GenerateEvent(G4Event* anEvent , G4Part G4double FinalBeamEnergy = 0 ; G4double InitialBeamEnergy = RandGauss::shoot(m_BeamEnergy, m_BeamEnergySpread); - m_Target->CalculateBeamInteraction( 0, m_SigmaX, 0, m_SigmaThetaX, - 0, m_SigmaY, 0, m_SigmaPhiY, - InitialBeamEnergy, - BeamName, - InterCoord, Beam_thetaX, Beam_phiY, - Beam_theta, Beam_phi, - FinalBeamEnergy); - - m_Reaction->SetBeamEnergy(FinalBeamEnergy); - m_InitConditions->SetICIncidentEnergy(FinalBeamEnergy / MeV); - + m_Target->CalculateBeamInteraction( 0, m_SigmaX, 0, m_SigmaThetaX, + 0, m_SigmaY, 0, m_SigmaPhiY, + InitialBeamEnergy, + BeamName, + InterCoord, Beam_thetaX, Beam_phiY, + Beam_theta, Beam_phi, + FinalBeamEnergy); + + m_Reaction->SetBeamEnergy(FinalBeamEnergy); + m_InitConditions->SetICIncidentEnergy(FinalBeamEnergy / MeV); // write vertex position to ROOT file G4double x0 = InterCoord.x(); @@ -542,8 +541,8 @@ void EventGeneratorTransfertToResonance::GenerateEvent(G4Event* anEvent , G4Part m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); // write angles/energy to ROOT file - m_InitConditions->SetICEmittedAngleThetaLabIncidentFrame(ThetaLight / deg); - m_InitConditions->SetICEmittedEnergy(EnergyLight/MeV); + m_InitConditions->SetICEmittedAngleThetaLabIncidentFrame(ThetaLight / deg); + m_InitConditions->SetICEmittedEnergy(EnergyLight/MeV); //Set the gun to shoot particleGun->SetParticleMomentumDirection(momentum_kine_world); //Shoot the light particle @@ -561,35 +560,34 @@ void EventGeneratorTransfertToResonance::GenerateEvent(G4Event* anEvent , G4Part if (phi_world < 1e-6) phi_world += 2*pi; if(m_ShootHeavy || m_ShootDecayProduct) - EventGeneratorTransfertToResonance::ResonanceDecay( EnergyHeavy , - theta_world , - phi_world , - x0 , - y0 , - z0 , - anEvent , - particleGun ); + EventGeneratorTransfertToResonance::ResonanceDecay( EnergyHeavy, + theta_world, + phi_world, + x0, + y0, + z0, + anEvent, + particleGun); } - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void EventGeneratorTransfertToResonance::ResonanceDecay( G4double EnergyHeavy , - G4double ThetaHeavy , - G4double PhiHeavy , - G4double x0 , - G4double y0 , - G4double z0 , - G4Event* anEvent , - G4ParticleGun* particleGun ) +void EventGeneratorTransfertToResonance::ResonanceDecay( G4double EnergyHeavy, + G4double ThetaHeavy, + G4double PhiHeavy, + G4double x0, + G4double y0, + G4double z0, + G4Event* anEvent, + G4ParticleGun* particleGun) { G4double parentZ = m_Reaction->GetNucleus4()->GetZ() ; G4double parentA = m_Reaction->GetNucleus4()->GetA() ; - G4int NumberOfNeutrons = (parentA - parentZ) - (m_ResonanceDecayA - m_ResonanceDecayZ) ; - G4int NumberOfProtons = parentZ - m_ResonanceDecayZ ; - G4int NumberOfDecayProducts = NumberOfNeutrons + NumberOfProtons ; + G4int NumberOfNeutrons = (parentA - parentZ) - (m_ResonanceDecayA - m_ResonanceDecayZ) ; + G4int NumberOfProtons = parentZ - m_ResonanceDecayZ ; + G4int NumberOfDecayProducts = NumberOfNeutrons + NumberOfProtons ; if (NumberOfNeutrons < 0 || NumberOfProtons < 0) { G4cout << "Error input for Resonance decay" << G4endl; @@ -597,205 +595,206 @@ void EventGeneratorTransfertToResonance::ResonanceDecay( G4double EnergyHeavy } else { - //Obtain Mass of daughter Nuclei - G4ParticleDefinition* parent - = G4ParticleTable::GetParticleTable()->GetIon(parentZ, parentA, 0 ) ; - - G4ParticleDefinition* daughter - = G4ParticleTable::GetParticleTable()->GetIon(m_ResonanceDecayZ, m_ResonanceDecayA, 0.) ; - - G4ParticleDefinition* neutron - = G4ParticleTable::GetParticleTable()->FindParticle("neutron"); - - G4ParticleDefinition* proton - = G4ParticleTable::GetParticleTable()->FindParticle("proton"); - - G4double M = parent -> GetPDGMass() + m_Reaction->GetExcitation()*MeV ; - G4double md = daughter -> GetPDGMass() ; - G4double mn = neutron -> GetPDGMass() ; - G4double mp = proton -> GetPDGMass() ; - - // Check that we are above threshold: - // If the Resonnance go below the threshold, decay is forced at thereshold - if (M < md + NumberOfNeutrons*mn + NumberOfProtons*mp) - { - double NewExx = parent -> GetPDGMass() - md - NumberOfNeutrons*mn - NumberOfProtons*mp ; - M = parent -> GetPDGMass() + NewExx ; - } - - - G4double InitialE = EnergyHeavy + M ; - G4double InitialMomentumX = sqrt( InitialE*InitialE - M*M) * sin(ThetaHeavy) * cos(PhiHeavy) ; - G4double InitialMomentumY = sqrt( InitialE*InitialE - M*M) * sin(ThetaHeavy) * sin(PhiHeavy) ; - G4double InitialMomentumZ = sqrt( InitialE*InitialE - M*M) * cos(ThetaHeavy) ; - - TLorentzVector Initial = TLorentzVector(InitialMomentumX/GeV, InitialMomentumY/GeV, InitialMomentumZ/GeV,InitialE/GeV); - - // Array of masses express in GeV/c2 - double* masses = new double[NumberOfDecayProducts+1]; - - // Filling Array - masses[0] = md/GeV ; - - int ll = 1 ; - for(int i = 0 ; i < NumberOfNeutrons ; i++) - {masses[ll] = mn/GeV ; ll++;} - - for(int i = 0 ; i < NumberOfProtons ; i++) - {masses[ll] = mp/GeV ; ll++;} - - // Instentiate a Phase Space Generator, with flat distrution - TGenPhaseSpace TPhaseSpace ; - - if( !TPhaseSpace.SetDecay(Initial, NumberOfDecayProducts+1, masses) ) cout << "Warning: Phase Space Decay forbiden by kinematic, or more than 18 particles "<<endl; - - // Generate an event and store is weight in the Output Tree - m_EventWeight = TPhaseSpace.Generate() ; - - - TLorentzVector* daugterLV ; - double Energy; - G4ThreeVector Momentum; - if (m_ShootHeavy) - { - daugterLV = TPhaseSpace.GetDecay(0); - - Momentum = G4ThreeVector( daugterLV->X()*GeV , - daugterLV->Y()*GeV , - daugterLV->Z()*GeV ); - - Energy = daugterLV->E()*GeV-md ; - Momentum.unit() ; - - //Set the gun to shoot - particleGun->SetParticleDefinition(daughter) ; - particleGun->SetParticleMomentumDirection(Momentum) ; - particleGun->SetParticleEnergy(Energy) ; - particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)) ; - // Shoot the Daugter - particleGun->GeneratePrimaryVertex(anEvent) ; - - // get theta and phi in the world frame - G4double theta_world = Momentum.theta(); - G4double phi_world = Momentum.phi(); - if (phi_world < 1e-6) phi_world += 2*pi; - // write angles in ROOT file - m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); - m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); - m_InitConditions->SetICEmittedEnergy(Energy); - } - - if (m_ShootDecayProduct) - { - G4int jj = 1 ; - for ( int u = 0; u < NumberOfNeutrons ; u++) - { - daugterLV = TPhaseSpace.GetDecay(jj); - - Momentum = G4ThreeVector( daugterLV->X()*GeV , - daugterLV->Y()*GeV , - daugterLV->Z()*GeV ); - Energy = daugterLV->E()*GeV-mn ; - Momentum.unit() ; - //Set the gun to shoot - particleGun->SetParticleDefinition(neutron) ; - particleGun->SetParticleMomentumDirection(Momentum) ; - particleGun->SetParticleEnergy(Energy) ; - particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)) ; - // Shoot the Daugter - particleGun->GeneratePrimaryVertex(anEvent) ; - - // get theta and phi in the world frame - G4double theta_world = Momentum.theta(); - G4double phi_world = Momentum.phi(); - if (phi_world < 1e-6) phi_world += 2*pi; - // write angles in ROOT file - m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); - m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); - m_InitConditions->SetICEmittedEnergy(Energy); - - jj++; - } - - for ( int u = 0; u < NumberOfProtons ; u++) - { - daugterLV = TPhaseSpace.GetDecay(jj); - - Momentum = G4ThreeVector( daugterLV->X()*GeV , - daugterLV->Y()*GeV , - daugterLV->Z()*GeV ); - Energy = daugterLV->E()*GeV-mp ; - Momentum.unit() ; - //Set the gun to shoot - particleGun->SetParticleDefinition(proton) ; - particleGun->SetParticleMomentumDirection(Momentum) ; - particleGun->SetParticleEnergy(Energy) ; - particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)) ; - // Shoot the Daugter - particleGun->GeneratePrimaryVertex(anEvent) ; - - // get theta and phi in the world frame - G4double theta_world = Momentum.theta(); - G4double phi_world = Momentum.phi(); - if (phi_world < 1e-6) phi_world += 2*pi; - // write angles in ROOT file - m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); - m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); - m_InitConditions->SetICEmittedEnergy(Energy); - jj++; - } - - - } - - delete masses ; - } + //Obtain Mass of daughter Nuclei + G4ParticleDefinition* parent + = G4ParticleTable::GetParticleTable()->GetIon(parentZ, parentA, 0 ); + + G4ParticleDefinition* daughter + = G4ParticleTable::GetParticleTable()->GetIon(m_ResonanceDecayZ, m_ResonanceDecayA, 0.); + + G4ParticleDefinition* neutron + = G4ParticleTable::GetParticleTable()->FindParticle("neutron"); + + G4ParticleDefinition* proton + = G4ParticleTable::GetParticleTable()->FindParticle("proton"); + + G4double M = parent -> GetPDGMass() + m_Reaction->GetExcitation()*MeV; + G4double md = daughter -> GetPDGMass() ; + G4double mn = neutron -> GetPDGMass() ; + G4double mp = proton -> GetPDGMass() ; + + // Check that we are above threshold: + // If the Resonnance go below the threshold, decay is forced at thereshold + if (M < md + NumberOfNeutrons*mn + NumberOfProtons*mp) + { + double NewExx = parent -> GetPDGMass() - md - NumberOfNeutrons*mn - NumberOfProtons*mp ; + M = parent -> GetPDGMass() + NewExx ; + } + + + G4double InitialE = EnergyHeavy + M ; + G4double InitialMomentumX = sqrt( InitialE*InitialE - M*M) * sin(ThetaHeavy) * cos(PhiHeavy) ; + G4double InitialMomentumY = sqrt( InitialE*InitialE - M*M) * sin(ThetaHeavy) * sin(PhiHeavy) ; + G4double InitialMomentumZ = sqrt( InitialE*InitialE - M*M) * cos(ThetaHeavy) ; + + TLorentzVector Initial = TLorentzVector(InitialMomentumX/GeV, InitialMomentumY/GeV, InitialMomentumZ/GeV,InitialE/GeV); + + // Array of masses express in GeV/c2 + double* masses = new double[NumberOfDecayProducts+1]; + + // Filling Array + masses[0] = md/GeV ; + + int ll = 1 ; + for(int i = 0 ; i < NumberOfNeutrons ; i++) + {masses[ll] = mn/GeV ; ll++;} + + for(int i = 0 ; i < NumberOfProtons ; i++) + {masses[ll] = mp/GeV ; ll++;} + + // Instentiate a Phase Space Generator, with flat distrution + TGenPhaseSpace TPhaseSpace ; + + if( !TPhaseSpace.SetDecay(Initial, NumberOfDecayProducts+1, masses) ) cout << "Warning: Phase Space Decay forbiden by kinematic, or more than 18 particles "<<endl; + + // Generate an event and store is weight in the Output Tree + m_EventWeight = TPhaseSpace.Generate() ; + + + TLorentzVector* daugterLV ; + double Energy; + G4ThreeVector Momentum; + if (m_ShootHeavy) + { + daugterLV = TPhaseSpace.GetDecay(0); + + Momentum = G4ThreeVector( daugterLV->X()*GeV , + daugterLV->Y()*GeV , + daugterLV->Z()*GeV ); + + Energy = daugterLV->E()*GeV-md ; + Momentum.unit() ; + + //Set the gun to shoot + particleGun->SetParticleDefinition(daughter); + particleGun->SetParticleMomentumDirection(Momentum); + particleGun->SetParticleEnergy(Energy); + particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)); + // Shoot the Daugter + particleGun->GeneratePrimaryVertex(anEvent) ; + + // get theta and phi in the world frame + G4double theta_world = Momentum.theta(); + G4double phi_world = Momentum.phi(); + if (phi_world < 1e-6) phi_world += 2*pi; + // write angles in ROOT file + m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); + m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); + m_InitConditions->SetICEmittedEnergy(Energy); + } + + if (m_ShootDecayProduct) + { + G4int jj = 1 ; + for ( int u = 0; u < NumberOfNeutrons ; u++) + { + daugterLV = TPhaseSpace.GetDecay(jj); + + Momentum = G4ThreeVector( daugterLV->X()*GeV, + daugterLV->Y()*GeV, + daugterLV->Z()*GeV); + Energy = daugterLV->E()*GeV-mn ; + Momentum.unit() ; + //Set the gun to shoot + particleGun->SetParticleDefinition(neutron); + particleGun->SetParticleMomentumDirection(Momentum); + particleGun->SetParticleEnergy(Energy); + particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)); + // Shoot the Daugter + particleGun->GeneratePrimaryVertex(anEvent) ; + + // get theta and phi in the world frame + G4double theta_world = Momentum.theta(); + G4double phi_world = Momentum.phi(); + if (phi_world < 1e-6) phi_world += 2*pi; + // write angles in ROOT file + m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); + m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); + m_InitConditions->SetICEmittedEnergy(Energy); + + jj++; + } + + for ( int u = 0; u < NumberOfProtons ; u++) + { + daugterLV = TPhaseSpace.GetDecay(jj); + + Momentum = G4ThreeVector( daugterLV->X()*GeV, + daugterLV->Y()*GeV, + daugterLV->Z()*GeV); + Energy = daugterLV->E()*GeV-mp ; + Momentum.unit() ; + //Set the gun to shoot + particleGun->SetParticleDefinition(proton); + particleGun->SetParticleMomentumDirection(Momentum); + particleGun->SetParticleEnergy(Energy); + particleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)); + // Shoot the Daugter + particleGun->GeneratePrimaryVertex(anEvent); + + // get theta and phi in the world frame + G4double theta_world = Momentum.theta(); + G4double phi_world = Momentum.phi(); + if (phi_world < 1e-6) phi_world += 2*pi; + // write angles in ROOT file + m_InitConditions->SetICEmittedAngleThetaLabWorldFrame(theta_world / deg); + m_InitConditions->SetICEmittedAnglePhiWorldFrame(phi_world / deg); + m_InitConditions->SetICEmittedEnergy(Energy); + jj++; + } + + + } + + delete masses ; + } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void EventGeneratorTransfertToResonance::SetEverything( string name1 , - string name2 , - string name3 , - string name4 , - double BeamEnergy , - double ExcitationLight , - double ExcitationHeavy , - double BeamEnergySpread , - double SigmaX , - double SigmaY , - double SigmaThetaX , - double SigmaPhiY , - double ResonanceWidth , - int ResonanceDecayZ , - int ResonanceDecayA , - bool ShootLight , - bool ShootHeavy , - bool ShootDecayProduct , - string Path ) +void EventGeneratorTransfertToResonance::SetEverything( string name1, + string name2, + string name3, + string name4, + double BeamEnergy, + double ExcitationLight, + double ExcitationHeavy, + double BeamEnergySpread, + double SigmaX, + double SigmaY, + double SigmaThetaX, + double SigmaPhiY, + double ResonanceWidth, + int ResonanceDecayZ, + int ResonanceDecayA, + bool ShootLight, + bool ShootHeavy, + bool ShootDecayProduct, + string Path) { //------------- Constructor with nuclei names and beam energy ------------ - m_Reaction = new Reaction ( name1 , - name2 , - name3 , - name4 , - BeamEnergy, - ExcitationLight, - ExcitationHeavy, - Path) ; - m_BeamEnergy = BeamEnergy; - m_BeamEnergySpread = BeamEnergySpread ; - m_SigmaX = SigmaX ; - m_SigmaY = SigmaY ; - m_SigmaThetaX = SigmaThetaX ; - m_SigmaPhiY = SigmaPhiY ; - m_ResonanceWidth = ResonanceWidth ; - m_ResonanceMean = ExcitationHeavy ; - m_ResonanceDecayZ = ResonanceDecayZ ; - m_ResonanceDecayA = ResonanceDecayA ; - m_ShootLight = ShootLight ; - m_ShootHeavy = ShootHeavy ; - m_ShootDecayProduct = ShootDecayProduct ; + m_Reaction = new Reaction ( name1 , + name2 , + name3 , + name4 , + BeamEnergy, + ExcitationLight, + ExcitationHeavy, + Path) ; + + m_BeamEnergy = BeamEnergy; + m_BeamEnergySpread = BeamEnergySpread; + m_SigmaX = SigmaX; + m_SigmaY = SigmaY; + m_SigmaThetaX = SigmaThetaX; + m_SigmaPhiY = SigmaPhiY; + m_ResonanceWidth = ResonanceWidth; + m_ResonanceMean = ExcitationHeavy; + m_ResonanceDecayZ = ResonanceDecayZ; + m_ResonanceDecayA = ResonanceDecayA; + m_ShootLight = ShootLight; + m_ShootHeavy = ShootHeavy; + m_ShootDecayProduct = ShootDecayProduct; } diff --git a/NPSimulation/src/GaspardTrackerAnnular.cc b/NPSimulation/src/GaspardTrackerAnnular.cc index 45c708fe5..8b51e0d42 100644 --- a/NPSimulation/src/GaspardTrackerAnnular.cc +++ b/NPSimulation/src/GaspardTrackerAnnular.cc @@ -261,7 +261,7 @@ void GaspardTrackerAnnular::VolumeMaker(G4int TelescopeNumber , logicSilicon->SetSensitiveDetector(m_FirstStageScorer); ///Visualisation of Silicon Strip - G4VisAttributes* SiliconVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; // blue + G4VisAttributes* SiliconVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; // blue logicSilicon->SetVisAttributes(SiliconVisAtt) ; } @@ -284,7 +284,7 @@ void GaspardTrackerAnnular::VolumeMaker(G4int TelescopeNumber , PVPBuffer = new G4PVPlacement(0, positionSecondStage, logicSecondStage, Name + "_SecondStage", logicMM, false, 0); ///Visualisation of Second Stage - G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.9, 0, 0)); // red + G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.9, 0, 0)); // red logicSecondStage->SetVisAttributes(SecondStageVisAtt); // Set Second Stage sensible @@ -310,7 +310,7 @@ void GaspardTrackerAnnular::VolumeMaker(G4int TelescopeNumber , PVPBuffer = new G4PVPlacement(0, positionThirdStage, logicThirdStage, Name + "_ThirdStage", logicMM, false, 0); ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.)) ; // green + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.)) ; // green logicThirdStage->SetVisAttributes(ThirdStageVisAtt) ; // Set Third Stage sensible @@ -350,13 +350,13 @@ void GaspardTrackerAnnular::ReadConfiguration(string Path) G4cout << "///" << G4endl ; G4cout << "Annular element found: " << G4endl ; ReadingStatus = true ;} - - while(ReadingStatus){ + + while(ReadingStatus){ - ConfigFile >> DataBuffer; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + ConfigFile >> DataBuffer; + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + //Position method @@ -387,19 +387,19 @@ void GaspardTrackerAnnular::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 11, "FIRSTSTAGE=") == 0) { - check_FirstStage = true ; + check_FirstStage = true ; ConfigFile >> DataBuffer; FIRSTSTAGE = atof(DataBuffer.c_str()) ; } else if (DataBuffer.compare(0, 12, "SECONDSTAGE=") == 0) { - check_SecondStage = true ; + check_SecondStage = true ; ConfigFile >> DataBuffer; SECONDSTAGE = atof(DataBuffer.c_str()) ; } else if (DataBuffer.compare(0, 11, "THIRDSTAGE=") == 0) { - check_ThirdStage = true ; + check_ThirdStage = true ; ConfigFile >> DataBuffer; THIRDSTAGE = atof(DataBuffer.c_str()) ; } @@ -409,19 +409,19 @@ void GaspardTrackerAnnular::ReadConfiguration(string Path) if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } - else { + else { G4cout << "WARNIG: Wrong Token Sequence, GaspardTrackerAnnular: Annular Element not added" << G4endl; - } + } if (check_Z && check_Rmin && check_Rmax && check_FirstStage && check_SecondStage && check_ThirdStage) { ReadingStatus = false ; check_Z = false ; - check_Rmin = false ; - check_Rmax = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; + check_Rmin = false ; + check_Rmax = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; AddModule(Z, Rmin, diff --git a/NPSimulation/src/GaspardTrackerDummyShape.cc b/NPSimulation/src/GaspardTrackerDummyShape.cc index e4dcf07c0..753c3f58c 100644 --- a/NPSimulation/src/GaspardTrackerDummyShape.cc +++ b/NPSimulation/src/GaspardTrackerDummyShape.cc @@ -250,7 +250,7 @@ void GaspardTrackerDummyShape::VolumeMaker(G4int TelescopeNumber, logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue logicFirstStage->SetVisAttributes(FirstStageVisAtt); } @@ -302,7 +302,7 @@ void GaspardTrackerDummyShape::VolumeMaker(G4int TelescopeNumber, logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // green + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // green logicThirdStage->SetVisAttributes(ThirdStageVisAtt); } } @@ -361,7 +361,7 @@ void GaspardTrackerDummyShape::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -494,15 +494,15 @@ void GaspardTrackerDummyShape::ReadConfiguration(string Path) // With position method if ((check_A && check_B && check_C && check_D && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_Theta && check_Phi && check_R)) { - ReadingStatus = false; - check_A = false; - check_C = false; - check_B = false; - check_D = false; - check_FirstStage = false; - check_SecondStage = false; - check_ThirdStage = false; - checkVis = false; + ReadingStatus = false; + check_A = false; + check_C = false; + check_B = false; + check_D = false; + check_FirstStage = false; + check_SecondStage = false; + check_ThirdStage = false; + checkVis = false; AddModule(A, B, C, D, FIRSTSTAGE == 1, SECONDSTAGE == 1, THIRDSTAGE == 1); } @@ -512,14 +512,14 @@ void GaspardTrackerDummyShape::ReadConfiguration(string Path) !(check_A && check_B && check_C && check_D)) { ReadingStatus = false; check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - check_FirstStage = false; - check_SecondStage = false; - check_ThirdStage = false; - checkVis = false; - + check_Phi = false; + check_R = false; + check_beta = false; + check_FirstStage = false; + check_SecondStage = false; + check_ThirdStage = false; + checkVis = false; + AddModule(R, Theta, Phi, beta_u, beta_v, beta_w, FIRSTSTAGE == 1, SECONDSTAGE == 1, THIRDSTAGE == 1); } } diff --git a/NPSimulation/src/GaspardTrackerSquare.cc b/NPSimulation/src/GaspardTrackerSquare.cc index 99f3974a0..c6b0e9f64 100644 --- a/NPSimulation/src/GaspardTrackerSquare.cc +++ b/NPSimulation/src/GaspardTrackerSquare.cc @@ -283,7 +283,7 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue logicFirstStage->SetVisAttributes(FirstStageVisAtt); } @@ -335,7 +335,7 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // green + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // green logicThirdStage->SetVisAttributes(ThirdStageVisAtt); } } @@ -364,7 +364,7 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; int FIRSTSTAGE = 0 , SECONDSTAGE = 0 , THIRDSTAGE = 0 ; - bool ReadingStatus = false ; + bool ReadingStatus = false ; bool check_A = false ; bool check_C = false ; @@ -392,9 +392,9 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) while(ReadingStatus){ ConfigFile >> DataBuffer; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -461,7 +461,7 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) } - // Angle method + // Angle method else if (DataBuffer.compare(0, 6, "THETA=") == 0) { check_Theta = true; ConfigFile >> DataBuffer ; @@ -507,7 +507,7 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 12, "SECONDSTAGE=") == 0) { - check_SecondStage = true ; + check_SecondStage = true ; ConfigFile >> DataBuffer; SECONDSTAGE = atof(DataBuffer.c_str()) ; } @@ -519,7 +519,7 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 4, "VIS=") == 0) { - checkVis = true ; + checkVis = true ; ConfigFile >> DataBuffer; if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } @@ -531,14 +531,14 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) if ((check_A && check_B && check_C && check_D && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_Theta && check_Phi && check_R)) { ReadingStatus = false ; - check_A = false ; - check_C = false ; - check_B = false ; - check_D = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; + check_A = false ; + check_C = false ; + check_B = false ; + check_D = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; AddModule(A , B , @@ -551,16 +551,16 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) //with angle method if ((check_Theta && check_Phi && check_R && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_A && check_B && check_C && check_D)) { - ReadingStatus = false ; - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; - + ReadingStatus = false ; + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; + AddModule(R , Theta , Phi , diff --git a/NPSimulation/src/GaspardTrackerTrapezoid.cc b/NPSimulation/src/GaspardTrackerTrapezoid.cc index 259923c65..28b384ce2 100644 --- a/NPSimulation/src/GaspardTrackerTrapezoid.cc +++ b/NPSimulation/src/GaspardTrackerTrapezoid.cc @@ -286,7 +286,7 @@ void GaspardTrackerTrapezoid::VolumeMaker(G4int TelescopeNumber , logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); ///Visualisation of FirstStage Strip - G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue logicFirstStage->SetVisAttributes(FirstStageVisAtt); } @@ -344,7 +344,7 @@ void GaspardTrackerTrapezoid::VolumeMaker(G4int TelescopeNumber , logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // red + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // red logicThirdStage->SetVisAttributes(ThirdStageVisAtt); } } @@ -373,7 +373,7 @@ void GaspardTrackerTrapezoid::ReadConfiguration(string Path) G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; int FIRSTSTAGE = 0 , SECONDSTAGE = 0 , THIRDSTAGE = 0 ; - bool ReadingStatus = false ; + bool ReadingStatus = false ; bool check_A = false ; bool check_C = false ; @@ -401,9 +401,9 @@ void GaspardTrackerTrapezoid::ReadConfiguration(string Path) while(ReadingStatus){ ConfigFile >> DataBuffer; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -470,7 +470,7 @@ void GaspardTrackerTrapezoid::ReadConfiguration(string Path) } - // Angle method + // Angle method else if (DataBuffer.compare(0, 6, "THETA=") == 0) { check_Theta = true; ConfigFile >> DataBuffer ; @@ -516,7 +516,7 @@ void GaspardTrackerTrapezoid::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 12, "SECONDSTAGE=") == 0) { - check_SecondStage = true ; + check_SecondStage = true ; ConfigFile >> DataBuffer; SECONDSTAGE = atof(DataBuffer.c_str()) ; } @@ -528,7 +528,7 @@ void GaspardTrackerTrapezoid::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 4, "VIS=") == 0) { - checkVis = true ; + checkVis = true ; ConfigFile >> DataBuffer; if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } @@ -540,14 +540,14 @@ void GaspardTrackerTrapezoid::ReadConfiguration(string Path) if ((check_A && check_B && check_C && check_D && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_Theta && check_Phi && check_R)) { ReadingStatus = false ; - check_A = false ; - check_C = false ; - check_B = false ; - check_D = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; + check_A = false ; + check_C = false ; + check_B = false ; + check_D = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; AddModule(A , B , @@ -560,16 +560,16 @@ void GaspardTrackerTrapezoid::ReadConfiguration(string Path) //with angle method if ((check_Theta && check_Phi && check_R && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_A && check_B && check_C && check_D)) { - ReadingStatus = false ; - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; - + ReadingStatus = false ; + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; + AddModule(R , Theta , Phi , diff --git a/NPSimulation/src/GeneralScorers.cc b/NPSimulation/src/GeneralScorers.cc index f06834987..57a4c74f0 100644 --- a/NPSimulation/src/GeneralScorers.cc +++ b/NPSimulation/src/GeneralScorers.cc @@ -28,8 +28,8 @@ using namespace GENERALSCORERS ; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// The following function is used in many scorer. following the Detector Volume Nomenclature -// DetectorNameX_SubPart_SubPart +// The following function is used in many scorer. following the Detector Volume Nomenclature +// DetectorNameX_SubPart_SubPart // where X stand for the detector number. int GENERALSCORERS::PickUpDetectorNumber(G4Step* aStep, std::string DetName) @@ -67,8 +67,8 @@ PSDetectorNumber::~PSDetectorNumber() } G4bool PSDetectorNumber::ProcessHits(G4Step* aStep, G4TouchableHistory*) - { - int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; + { + int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; G4double edep = aStep->GetTotalEnergyDeposit(); @@ -126,7 +126,7 @@ void PSDetectorNumber::PrintAll() PSEnergy::PSEnergy(G4String name, G4String VolumeName, G4int depth) : G4VPrimitiveScorer(name, depth), HCID(-1) { - m_VolumeName = VolumeName; + m_VolumeName = VolumeName; } PSEnergy::~PSEnergy() @@ -135,7 +135,7 @@ PSEnergy::~PSEnergy() G4bool PSEnergy::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; + int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; G4double edep = aStep->GetTotalEnergyDeposit(); if (edep < TriggerThreshold) return FALSE; @@ -243,7 +243,7 @@ void PSTOF::PrintAll() PSInteractionCoordinatesX::PSInteractionCoordinatesX(G4String name, G4String VolumeName, G4int depth) : G4VPrimitiveScorer(name, depth), HCID(-1) { - m_VolumeName = VolumeName; + m_VolumeName = VolumeName; } PSInteractionCoordinatesX::~PSInteractionCoordinatesX() @@ -252,7 +252,7 @@ PSInteractionCoordinatesX::~PSInteractionCoordinatesX() G4bool PSInteractionCoordinatesX::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; + int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); G4double pos_x = POS.x() / mm; @@ -298,7 +298,7 @@ void PSInteractionCoordinatesX::PrintAll() PSInteractionCoordinatesY::PSInteractionCoordinatesY(G4String name, G4String VolumeName, G4int depth) : G4VPrimitiveScorer(name, depth), HCID(-1) { - m_VolumeName = VolumeName; + m_VolumeName = VolumeName; } PSInteractionCoordinatesY::~PSInteractionCoordinatesY() @@ -307,7 +307,7 @@ PSInteractionCoordinatesY::~PSInteractionCoordinatesY() G4bool PSInteractionCoordinatesY::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; + int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); G4double pos_y = POS.y() / mm; @@ -354,7 +354,7 @@ void PSInteractionCoordinatesY::PrintAll() PSInteractionCoordinatesZ::PSInteractionCoordinatesZ(G4String name, G4String VolumeName, G4int depth) : G4VPrimitiveScorer(name, depth), HCID(-1) { - m_VolumeName = VolumeName; + m_VolumeName = VolumeName; } PSInteractionCoordinatesZ::~PSInteractionCoordinatesZ() @@ -363,7 +363,7 @@ PSInteractionCoordinatesZ::~PSInteractionCoordinatesZ() G4bool PSInteractionCoordinatesZ::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; + int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); G4double pos_z = POS.z() / mm; @@ -410,7 +410,7 @@ void PSInteractionCoordinatesZ::PrintAll() PSInteractionCoordinatesAngleTheta::PSInteractionCoordinatesAngleTheta(G4String name, G4String VolumeName, G4int depth) : G4VPrimitiveScorer(name, depth), HCID(-1) { - m_VolumeName = VolumeName; + m_VolumeName = VolumeName; } PSInteractionCoordinatesAngleTheta::~PSInteractionCoordinatesAngleTheta() @@ -419,7 +419,7 @@ PSInteractionCoordinatesAngleTheta::~PSInteractionCoordinatesAngleTheta() G4bool PSInteractionCoordinatesAngleTheta::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; + int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); G4double angle_theta = POS.theta() / deg; @@ -466,7 +466,7 @@ void PSInteractionCoordinatesAngleTheta::PrintAll() PSInteractionCoordinatesAnglePhi::PSInteractionCoordinatesAnglePhi(G4String name, G4String VolumeName, G4int depth) : G4VPrimitiveScorer(name, depth), HCID(-1) { - m_VolumeName = VolumeName; + m_VolumeName = VolumeName; } PSInteractionCoordinatesAnglePhi::~PSInteractionCoordinatesAnglePhi() @@ -475,7 +475,7 @@ PSInteractionCoordinatesAnglePhi::~PSInteractionCoordinatesAnglePhi() G4bool PSInteractionCoordinatesAnglePhi::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; + int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName) ; G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); G4double angle_phi = POS.phi() / deg; diff --git a/NPSimulation/src/HydeTrackerAnnular.cc b/NPSimulation/src/HydeTrackerAnnular.cc index bd4603eb7..90e24deb8 100644 --- a/NPSimulation/src/HydeTrackerAnnular.cc +++ b/NPSimulation/src/HydeTrackerAnnular.cc @@ -360,13 +360,13 @@ void HydeTrackerAnnular::ReadConfiguration(string Path) G4cout << "///" << G4endl ; G4cout << "Annular element found: " << G4endl ; ReadingStatus = true ;} - - while(ReadingStatus){ + + while(ReadingStatus){ - ConfigFile >> DataBuffer; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + ConfigFile >> DataBuffer; + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + //Position method @@ -397,19 +397,19 @@ void HydeTrackerAnnular::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 11, "FIRSTSTAGE=") == 0) { - check_FirstStage = true ; + check_FirstStage = true ; ConfigFile >> DataBuffer; FIRSTSTAGE = atof(DataBuffer.c_str()) ; } else if (DataBuffer.compare(0, 12, "SECONDSTAGE=") == 0) { - check_SecondStage = true ; + check_SecondStage = true ; ConfigFile >> DataBuffer; SECONDSTAGE = atof(DataBuffer.c_str()) ; } else if (DataBuffer.compare(0, 11, "THIRDSTAGE=") == 0) { - check_ThirdStage = true ; + check_ThirdStage = true ; ConfigFile >> DataBuffer; THIRDSTAGE = atof(DataBuffer.c_str()) ; } @@ -419,19 +419,19 @@ void HydeTrackerAnnular::ReadConfiguration(string Path) if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } - else { + else { G4cout << "WARNIG: Wrong Token Sequence, HydeTrackerAnnular: Annular Element not added" << G4endl; - } + } if (check_Z && check_Rmin && check_Rmax && check_FirstStage && check_SecondStage && check_ThirdStage) { ReadingStatus = false ; check_Z = false ; - check_Rmin = false ; - check_Rmax = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; + check_Rmin = false ; + check_Rmax = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; AddModule(Z, Rmin, diff --git a/NPSimulation/src/HydeTrackerDummyShape.cc b/NPSimulation/src/HydeTrackerDummyShape.cc index 1040abe18..c7bc92367 100644 --- a/NPSimulation/src/HydeTrackerDummyShape.cc +++ b/NPSimulation/src/HydeTrackerDummyShape.cc @@ -364,7 +364,7 @@ void HydeTrackerDummyShape::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -497,15 +497,15 @@ void HydeTrackerDummyShape::ReadConfiguration(string Path) // With position method if ((check_A && check_B && check_C && check_D && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_Theta && check_Phi && check_R)) { - ReadingStatus = false; - check_A = false; - check_C = false; - check_B = false; - check_D = false; - check_FirstStage = false; - check_SecondStage = false; - check_ThirdStage = false; - checkVis = false; + ReadingStatus = false; + check_A = false; + check_C = false; + check_B = false; + check_D = false; + check_FirstStage = false; + check_SecondStage = false; + check_ThirdStage = false; + checkVis = false; AddModule(A, B, C, D, FIRSTSTAGE == 1, SECONDSTAGE == 1, THIRDSTAGE == 1); } @@ -513,16 +513,16 @@ void HydeTrackerDummyShape::ReadConfiguration(string Path) // With angle method if ((check_Theta && check_Phi && check_R && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_A && check_B && check_C && check_D)) { - ReadingStatus = false; - check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - check_FirstStage = false; - check_SecondStage = false; - check_ThirdStage = false; - checkVis = false; - + ReadingStatus = false; + check_Theta = false; + check_Phi = false; + check_R = false; + check_beta = false; + check_FirstStage = false; + check_SecondStage = false; + check_ThirdStage = false; + checkVis = false; + AddModule(R, Theta, Phi, beta_u, beta_v, beta_w, FIRSTSTAGE == 1, SECONDSTAGE == 1, THIRDSTAGE == 1); } } diff --git a/NPSimulation/src/HydeTrackerSquare.cc b/NPSimulation/src/HydeTrackerSquare.cc index 446ec2bc1..18a7ee81a 100644 --- a/NPSimulation/src/HydeTrackerSquare.cc +++ b/NPSimulation/src/HydeTrackerSquare.cc @@ -491,7 +491,7 @@ void HydeTrackerSquare::ReadConfiguration(string Path) G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; int FIRSTSTAGE = 0 , SECONDSTAGE = 0 , THIRDSTAGE = 0 ; - bool ReadingStatus = false ; + bool ReadingStatus = false ; bool check_A = false ; bool check_C = false ; @@ -519,9 +519,9 @@ void HydeTrackerSquare::ReadConfiguration(string Path) while(ReadingStatus){ ConfigFile >> DataBuffer; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -588,7 +588,7 @@ void HydeTrackerSquare::ReadConfiguration(string Path) } - // Angle method + // Angle method else if (DataBuffer.compare(0, 6, "THETA=") == 0) { check_Theta = true; ConfigFile >> DataBuffer ; @@ -634,7 +634,7 @@ void HydeTrackerSquare::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 12, "SECONDSTAGE=") == 0) { - check_SecondStage = true ; + check_SecondStage = true ; ConfigFile >> DataBuffer; SECONDSTAGE = atof(DataBuffer.c_str()) ; } @@ -646,7 +646,7 @@ void HydeTrackerSquare::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 4, "VIS=") == 0) { - checkVis = true ; + checkVis = true ; ConfigFile >> DataBuffer; if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } @@ -658,14 +658,14 @@ void HydeTrackerSquare::ReadConfiguration(string Path) if ((check_A && check_B && check_C && check_D && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_Theta && check_Phi && check_R)) { ReadingStatus = false ; - check_A = false ; - check_C = false ; - check_B = false ; - check_D = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; + check_A = false ; + check_C = false ; + check_B = false ; + check_D = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; AddModule(A , B , @@ -678,16 +678,16 @@ void HydeTrackerSquare::ReadConfiguration(string Path) //with angle method if ((check_Theta && check_Phi && check_R && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_A && check_B && check_C && check_D)) { - ReadingStatus = false ; - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; - + ReadingStatus = false ; + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; + AddModule(R , Theta , Phi , diff --git a/NPSimulation/src/HydeTrackerTrapezoid.cc b/NPSimulation/src/HydeTrackerTrapezoid.cc index 6c696c87b..11a8f0363 100644 --- a/NPSimulation/src/HydeTrackerTrapezoid.cc +++ b/NPSimulation/src/HydeTrackerTrapezoid.cc @@ -383,7 +383,7 @@ void HydeTrackerTrapezoid::ReadConfiguration(string Path) G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; int FIRSTSTAGE = 0 , SECONDSTAGE = 0 , THIRDSTAGE = 0 ; - bool ReadingStatus = false ; + bool ReadingStatus = false ; bool check_A = false ; bool check_C = false ; @@ -411,9 +411,9 @@ void HydeTrackerTrapezoid::ReadConfiguration(string Path) while(ReadingStatus){ ConfigFile >> DataBuffer; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -480,7 +480,7 @@ void HydeTrackerTrapezoid::ReadConfiguration(string Path) } - // Angle method + // Angle method else if (DataBuffer.compare(0, 6, "THETA=") == 0) { check_Theta = true; ConfigFile >> DataBuffer ; @@ -526,7 +526,7 @@ void HydeTrackerTrapezoid::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 12, "SECONDSTAGE=") == 0) { - check_SecondStage = true ; + check_SecondStage = true ; ConfigFile >> DataBuffer; SECONDSTAGE = atof(DataBuffer.c_str()) ; } @@ -538,7 +538,7 @@ void HydeTrackerTrapezoid::ReadConfiguration(string Path) } else if (DataBuffer.compare(0, 4, "VIS=") == 0) { - checkVis = true ; + checkVis = true ; ConfigFile >> DataBuffer; if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } @@ -550,14 +550,14 @@ void HydeTrackerTrapezoid::ReadConfiguration(string Path) if ((check_A && check_B && check_C && check_D && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_Theta && check_Phi && check_R)) { ReadingStatus = false ; - check_A = false ; - check_C = false ; - check_B = false ; - check_D = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; + check_A = false ; + check_C = false ; + check_B = false ; + check_D = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; AddModule(A , B , @@ -570,16 +570,16 @@ void HydeTrackerTrapezoid::ReadConfiguration(string Path) //with angle method if ((check_Theta && check_Phi && check_R && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_A && check_B && check_C && check_D)) { - ReadingStatus = false ; - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; - check_FirstStage = false ; - check_SecondStage = false ; - check_ThirdStage = false ; - checkVis = false ; - + ReadingStatus = false ; + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; + AddModule(R , Theta , Phi , diff --git a/NPSimulation/src/MUST2Array.cc b/NPSimulation/src/MUST2Array.cc index 70ac92439..e55ea8bf1 100644 --- a/NPSimulation/src/MUST2Array.cc +++ b/NPSimulation/src/MUST2Array.cc @@ -62,7 +62,7 @@ using namespace MUST2 ; MUST2Array::MUST2Array() { m_Event = new TMust2Data() ; - InitializeMaterial() ; + InitializeMaterial(); } MUST2Array::~MUST2Array() @@ -76,77 +76,77 @@ MUST2Array::~MUST2Array() } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void MUST2Array::AddTelescope(G4ThreeVector X1_Y1 , - G4ThreeVector X128_Y1 , - G4ThreeVector X1_Y128 , - G4ThreeVector X128_Y128 , - bool wSi , - bool wSiLi , - bool wCsI) +void MUST2Array::AddTelescope( G4ThreeVector X1_Y1, + G4ThreeVector X128_Y1, + G4ThreeVector X1_Y128, + G4ThreeVector X128_Y128, + bool wSi, + bool wSiLi, + bool wCsI) { - m_DefinitionType.push_back(true) ; - - m_X1_Y1 .push_back(X1_Y1) ; - m_X128_Y1 .push_back(X128_Y1) ; - m_X1_Y128 .push_back(X1_Y128) ; - m_X128_Y128 .push_back(X128_Y128) ; - m_wSi.push_back(wSi) ; - m_wSiLi.push_back(wSiLi) ; - m_wCsI.push_back(wCsI) ; - - m_R.push_back(0) ; - m_Theta.push_back(0) ; - m_Phi.push_back(0) ; - m_beta_u.push_back(0) ; - m_beta_v.push_back(0) ; - m_beta_w.push_back(0) ; + m_DefinitionType.push_back(true); + + m_X1_Y1 .push_back(X1_Y1); + m_X128_Y1 .push_back(X128_Y1); + m_X1_Y128 .push_back(X1_Y128); + m_X128_Y128 .push_back(X128_Y128); + m_wSi.push_back(wSi); + m_wSiLi.push_back(wSiLi); + m_wCsI.push_back(wCsI); + + m_R.push_back(0); + m_Theta.push_back(0); + m_Phi.push_back(0); + m_beta_u.push_back(0); + m_beta_v.push_back(0); + m_beta_w.push_back(0); } -void MUST2Array::AddTelescope(G4double R , - G4double Theta , - G4double Phi , - G4double beta_u , - G4double beta_v , - G4double beta_w , - bool wSi , - bool wSiLi , - bool wCsI) +void MUST2Array::AddTelescope( G4double R, + G4double Theta, + G4double Phi, + G4double beta_u, + G4double beta_v, + G4double beta_w, + bool wSi, + bool wSiLi, + bool wCsI) { - G4ThreeVector empty = G4ThreeVector(0, 0, 0) ; + G4ThreeVector empty = G4ThreeVector(0, 0, 0); - m_DefinitionType.push_back(false) ; + m_DefinitionType.push_back(false); - m_R.push_back(R) ; - m_Theta.push_back(Theta) ; - m_Phi.push_back(Phi) ; - m_beta_u.push_back(beta_u) ; - m_beta_v.push_back(beta_v) ; - m_beta_w.push_back(beta_w) ; - m_wSi.push_back(wSi) ; - m_wSiLi.push_back(wSiLi) ; - m_wCsI.push_back(wCsI) ; + m_R.push_back(R); + m_Theta.push_back(Theta); + m_Phi.push_back(Phi); + m_beta_u.push_back(beta_u); + m_beta_v.push_back(beta_v); + m_beta_w.push_back(beta_w); + m_wSi.push_back(wSi); + m_wSiLi.push_back(wSiLi); + m_wCsI.push_back(wCsI); - m_X1_Y1 .push_back(empty) ; - m_X128_Y1 .push_back(empty) ; - m_X1_Y128 .push_back(empty) ; - m_X128_Y128 .push_back(empty) ; + m_X1_Y1 .push_back(empty) ; + m_X128_Y1 .push_back(empty) ; + m_X1_Y128 .push_back(empty) ; + m_X128_Y128 .push_back(empty) ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void MUST2Array::VolumeMaker(G4int TelescopeNumber , - G4ThreeVector MMpos , - G4RotationMatrix* MMrot , - bool wSi , - bool wSiLi , - bool wCsI , - G4LogicalVolume* world) +void MUST2Array::VolumeMaker( G4int TelescopeNumber, + G4ThreeVector MMpos, + G4RotationMatrix* MMrot, + bool wSi, + bool wSiLi, + bool wCsI, + G4LogicalVolume* world) { - G4double NbrTelescopes = TelescopeNumber ; - G4String DetectorNumber ; - std::ostringstream Number ; - Number << NbrTelescopes ; - DetectorNumber = Number.str() ; + G4double NbrTelescopes = TelescopeNumber; + G4String DetectorNumber; + std::ostringstream Number; + Number << NbrTelescopes ; + DetectorNumber = Number.str(); //////////////////////////////////////////////////////////////// ////////////// Starting Volume Definition ////////////////////// @@ -158,17 +158,17 @@ void MUST2Array::VolumeMaker(G4int TelescopeNumber , G4Trd* solidMM = new G4Trd("MUST2Telescope" + DetectorNumber, 0.5*FaceFront, 0.5*FaceBack, 0.5*FaceFront, 0.5*FaceBack, 0.5*Length); - G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, m_MaterialIron, "MUST2Telescope" + DetectorNumber, 0, 0, 0) ; + G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, m_MaterialIron, "MUST2Telescope" + DetectorNumber, 0, 0, 0); G4String Name = "MUST2Telescope" + DetectorNumber ; PVPBuffer = new G4PVPlacement( G4Transform3D(*MMrot, MMpos) , - logicMM , - Name , - world , - false , - 0 ); + logicMM , + Name , + world , + false , + 0 ); @@ -231,24 +231,23 @@ void MUST2Array::VolumeMaker(G4int TelescopeNumber , G4LogicalVolume* logicSiLi = new G4LogicalVolume(solidSiLi, m_MaterialAluminium, Name + "_SiLi" , 0, 0, 0); - PVPBuffer = new G4PVPlacement( G4Transform3D(*rotSiLi, G4ThreeVector(0,0,0) ) , - logicSiLi , - Name + "_SiLi" , - logicVacBox , - false , - 0 ); + PVPBuffer = new G4PVPlacement( G4Transform3D(*rotSiLi, G4ThreeVector(0,0,0) ) , + logicSiLi , + Name + "_SiLi", + logicVacBox , + false , + 0); // SiLi are placed inside of the VacBox... // Left/Right define when looking to detector from Si to CsI - G4double SiLi_HighY_Upper = 19.86 * mm ; - G4double SiLi_HighY_Center = 25.39 * mm ; - G4double SiLi_WidthX_Left = 22.85 * mm ; - G4double SiLi_WidthX_Right = 24.9 * mm ; - G4double SiLi_ShiftX = 0.775 * mm ; - - - // SiLi are organized by two group of 8 Up(9 to 15) and Down(1 to 8). - G4ThreeVector ShiftSiLiUp = G4ThreeVector(-0.25 * SiliconFace - 0.5 * SiLiSpace, 0, 0) ; + G4double SiLi_HighY_Upper = 19.86 * mm; + G4double SiLi_HighY_Center = 25.39 * mm; + G4double SiLi_WidthX_Left = 22.85 * mm; + G4double SiLi_WidthX_Right = 24.9 * mm; + G4double SiLi_ShiftX = 0.775 * mm; + + // SiLi are organized by two group of 8 Up(9 to 15) and Down(1 to 8). + G4ThreeVector ShiftSiLiUp = G4ThreeVector(-0.25 * SiliconFace - 0.5 * SiLiSpace, 0, 0) ; G4ThreeVector ShiftSiLiDown = G4ThreeVector(0.25 * SiliconFace + 0.5 * SiLiSpace, 0, 0) ; // SiLi : left side of SiLi detector @@ -263,137 +262,137 @@ void MUST2Array::VolumeMaker(G4int TelescopeNumber , G4LogicalVolume* logicSiLi_LT = new G4LogicalVolume(solidSiLi_LT , m_MaterialSilicon , "SiLi_LT" , 0 , 0 , 0); G4LogicalVolume* logicSiLi_RT = new G4LogicalVolume(solidSiLi_RT , m_MaterialSilicon , "SiLi_RT" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LC1 = new G4LogicalVolume(solidSiLi_LC1 , m_MaterialSilicon , "SiLi_LC1" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RC1 = new G4LogicalVolume(solidSiLi_RC1 , m_MaterialSilicon , "SiLi_RC1" , 0 , 0 , 0); + G4LogicalVolume* logicSiLi_LC1 = new G4LogicalVolume(solidSiLi_LC1 , m_MaterialSilicon , "SiLi_LC1" , 0 , 0 , 0); + G4LogicalVolume* logicSiLi_RC1 = new G4LogicalVolume(solidSiLi_RC1 , m_MaterialSilicon , "SiLi_RC1" , 0 , 0 , 0); G4LogicalVolume* logicSiLi_LB = new G4LogicalVolume(solidSiLi_LB , m_MaterialSilicon , "SiLi_LB" , 0 , 0 , 0); G4LogicalVolume* logicSiLi_RB = new G4LogicalVolume(solidSiLi_RB , m_MaterialSilicon , "SiLi_RB" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LC2 = new G4LogicalVolume(solidSiLi_LC2 , m_MaterialSilicon , "SiLi_LC2" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RC2 = new G4LogicalVolume(solidSiLi_RC2 , m_MaterialSilicon , "SiLi_RC2" , 0 , 0 , 0); + G4LogicalVolume* logicSiLi_LC2 = new G4LogicalVolume(solidSiLi_LC2 , m_MaterialSilicon , "SiLi_LC2" , 0 , 0 , 0); + G4LogicalVolume* logicSiLi_RC2 = new G4LogicalVolume(solidSiLi_RC2 , m_MaterialSilicon , "SiLi_RC2" , 0 , 0 , 0); G4double interSiLi = 0.5 * mm; // Top - G4ThreeVector positionSiLi_LT_up = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LT_up = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , + 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi, + 0); - positionSiLi_LT_up += ShiftSiLiUp ; + positionSiLi_LT_up += ShiftSiLiUp ; - G4ThreeVector positionSiLi_RT_up = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RT_up = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX, + 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi, + 0); - positionSiLi_RT_up += ShiftSiLiUp ; + positionSiLi_RT_up += ShiftSiLiUp ; - G4ThreeVector positionSiLi_LC1_up = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LC1_up = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , + 0.5 * SiLi_HighY_Center + 0.5 * interSiLi, + 0); - positionSiLi_LC1_up += ShiftSiLiUp ; + positionSiLi_LC1_up += ShiftSiLiUp ; - G4ThreeVector positionSiLi_RC1_up = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RC1_up = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX, + 0.5 * SiLi_HighY_Center + 0.5 * interSiLi, + 0); - positionSiLi_RC1_up += ShiftSiLiUp ; + positionSiLi_RC1_up += ShiftSiLiUp ; - G4ThreeVector positionSiLi_LB_up = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LB_up = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , + -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , + 0); - positionSiLi_LB_up += ShiftSiLiUp ; + positionSiLi_LB_up += ShiftSiLiUp ; - G4ThreeVector positionSiLi_RB_up = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RB_up = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX , + -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , + 0); - positionSiLi_RB_up += ShiftSiLiUp ; + positionSiLi_RB_up += ShiftSiLiUp ; - G4ThreeVector positionSiLi_LC2_up = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LC2_up = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , + -0.5 * SiLi_HighY_Center - 0.5 * interSiLi, + 0); - positionSiLi_LC2_up += ShiftSiLiUp ; + positionSiLi_LC2_up += ShiftSiLiUp ; - G4ThreeVector positionSiLi_RC2_up = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RC2_up = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX , + -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , + 0); - positionSiLi_RC2_up += ShiftSiLiUp ; + positionSiLi_RC2_up += ShiftSiLiUp ; // Down - G4ThreeVector positionSiLi_LT_down = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LT_down = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX, + 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi, + 0); - positionSiLi_LT_down += ShiftSiLiDown ; + positionSiLi_LT_down += ShiftSiLiDown ; - G4ThreeVector positionSiLi_RT_down = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RT_down = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX, + 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi, + 0); - positionSiLi_RT_down += ShiftSiLiDown ; + positionSiLi_RT_down += ShiftSiLiDown ; - G4ThreeVector positionSiLi_LC1_down = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LC1_down = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX, + 0.5 * SiLi_HighY_Center + 0.5 * interSiLi, + 0); - positionSiLi_LC1_down += ShiftSiLiDown ; + positionSiLi_LC1_down += ShiftSiLiDown ; - G4ThreeVector positionSiLi_RC1_down = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RC1_down = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX, + 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , + 0); - positionSiLi_RC1_down += ShiftSiLiDown ; + positionSiLi_RC1_down += ShiftSiLiDown ; - G4ThreeVector positionSiLi_LB_down = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LB_down = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX, + -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi, + 0); - positionSiLi_LB_down += ShiftSiLiDown ; + positionSiLi_LB_down += ShiftSiLiDown ; - G4ThreeVector positionSiLi_RB_down = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RB_down = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX, + -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi, + 0); - positionSiLi_RB_down += ShiftSiLiDown ; + positionSiLi_RB_down += ShiftSiLiDown ; - G4ThreeVector positionSiLi_LC2_down = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_LC2_down = G4ThreeVector( -0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX, + -0.5 * SiLi_HighY_Center - 0.5 * interSiLi, + 0); - positionSiLi_LC2_down += ShiftSiLiDown ; + positionSiLi_LC2_down += ShiftSiLiDown ; - G4ThreeVector positionSiLi_RC2_down = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); + G4ThreeVector positionSiLi_RC2_down = G4ThreeVector( 0.5 * SiLi_WidthX_Right - SiLi_ShiftX, + -0.5 * SiLi_HighY_Center - 0.5 * interSiLi, + 0); - positionSiLi_RC2_down += ShiftSiLiDown ; + positionSiLi_RC2_down += ShiftSiLiDown ; // up PVPBuffer = new G4PVPlacement(0 , positionSiLi_LT_up , logicSiLi_LT , Name + "_SiLi_Pad9" , logicSiLi , false , 0) ; PVPBuffer = new G4PVPlacement(0 , positionSiLi_RT_up , logicSiLi_RT , Name + "_SiLi_Pad10" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC1_up , logicSiLi_LC1 , Name + "_SiLi_Pad11" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC1_up , logicSiLi_RC1 , Name + "_SiLi_Pad12" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC1_up , logicSiLi_LC1 , Name + "_SiLi_Pad11" , logicSiLi , false , 0); + PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC1_up , logicSiLi_RC1 , Name + "_SiLi_Pad12" , logicSiLi , false , 0); PVPBuffer = new G4PVPlacement(0 , positionSiLi_LB_up , logicSiLi_LB , Name + "_SiLi_Pad16" , logicSiLi , false , 0) ; PVPBuffer = new G4PVPlacement(0 , positionSiLi_RB_up , logicSiLi_RB , Name + "_SiLi_Pad15" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC2_up , logicSiLi_LC2 , Name + "_SiLi_Pad14" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC2_up , logicSiLi_RC2 , Name + "_SiLi_Pad13" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC2_up , logicSiLi_LC2 , Name + "_SiLi_Pad14" , logicSiLi , false , 0); + PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC2_up , logicSiLi_RC2 , Name + "_SiLi_Pad13" , logicSiLi , false , 0); // down - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LT_down , logicSiLi_LT , Name + "_SiLi_Pad2" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RT_down , logicSiLi_RT , Name + "_SiLi_Pad1" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC1_down , logicSiLi_LC1 , Name + "_SiLi_Pad4" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC1_down , logicSiLi_RC1 , Name + "_SiLi_Pad3" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_LT_down , logicSiLi_LT , Name + "_SiLi_Pad2" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_RT_down , logicSiLi_RT , Name + "_SiLi_Pad1" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC1_down , logicSiLi_LC1 , Name + "_SiLi_Pad4" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC1_down , logicSiLi_RC1 , Name + "_SiLi_Pad3" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LB_down , logicSiLi_LB , Name + "_SiLi_Pad7" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RB_down , logicSiLi_RB , Name + "_SiLi_Pad8" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC2_down , logicSiLi_LC2 , Name + "_SiLi_Pad5" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC2_down , logicSiLi_RC2 , Name + "_SiLi_Pad6" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_LB_down , logicSiLi_LB , Name + "_SiLi_Pad7" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_RB_down , logicSiLi_RB , Name + "_SiLi_Pad8" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC2_down , logicSiLi_LC2 , Name + "_SiLi_Pad5" , logicSiLi , false , 0) ; + PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC2_down , logicSiLi_RC2 , Name + "_SiLi_Pad6" , logicSiLi , false , 0) ; @@ -803,55 +802,53 @@ void MUST2Array::ReadConfiguration(string Path) // If All necessary information there, toggle out if ( ( check_SI && check_SILI && check_CSI && check_VIS ) && ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R) ) ) { - ReadingStatus = false; - - ///Add The previously define telescope - //With position method - if ((check_A && check_B && check_C && check_D) || !(check_Theta && check_Phi && check_R)) - { - AddTelescope(A , - B , - C , - D , - SI == 1 , - SILI == 1 , - CSI == 1); - } - - //with angle method - else if ((check_Theta && check_Phi && check_R) || !(check_A && check_B && check_C && check_D)) - { - AddTelescope(R , - Theta , - Phi , - beta_u , - beta_v , - beta_w , - SI == 1 , - SILI == 1 , - CSI == 1); - } + ReadingStatus = false; + + ///Add The previously define telescope + //With position method + if ((check_A && check_B && check_C && check_D) || !(check_Theta && check_Phi && check_R)) + { + AddTelescope( A, + B, + C, + D, + SI == 1, + SILI == 1, + CSI == 1); + } + + //with angle method + else if ((check_Theta && check_Phi && check_R) || !(check_A && check_B && check_C && check_D)) + { + AddTelescope( R, + Theta, + Phi, + beta_u, + beta_v, + beta_w, + SI == 1, + SILI == 1, + CSI == 1); + } - check_A = false ; - check_C = false ; - check_B = false ; - check_D = false ; - - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; - - check_SI = false ; - check_SILI = false ; - check_CSI = false ; - check_VIS = false ; + check_A = false ; + check_C = false ; + check_B = false ; + check_D = false ; + + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; + + check_SI = false ; + check_SILI = false ; + check_CSI = false ; + check_VIS = false ; } - } - } } @@ -860,17 +857,17 @@ void MUST2Array::ReadConfiguration(string Path) // Called After DetecorConstruction::AddDetector Method void MUST2Array::ConstructDetector(G4LogicalVolume* world) { - G4RotationMatrix* MMrot = NULL ; - G4ThreeVector MMpos = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMu = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMv = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMw = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0) ; - bool Si = true ; - bool SiLi = true ; - bool CsI = true ; - - G4int NumberOfTelescope = m_DefinitionType.size() ; + G4RotationMatrix* MMrot = NULL ; + G4ThreeVector MMpos = G4ThreeVector(0, 0, 0) ; + G4ThreeVector MMu = G4ThreeVector(0, 0, 0) ; + G4ThreeVector MMv = G4ThreeVector(0, 0, 0) ; + G4ThreeVector MMw = G4ThreeVector(0, 0, 0) ; + G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0) ; + bool Si = true ; + bool SiLi = true ; + bool CsI = true ; + + G4int NumberOfTelescope = m_DefinitionType.size() ; for (G4int i = 0 ; i < NumberOfTelescope ; i++) { // By Point @@ -905,10 +902,10 @@ void MUST2Array::ConstructDetector(G4LogicalVolume* world) // w perpendicular to (u,v) plan and pointing ThirdStage // Phi is angle between X axis and projection in (X,Y) plan // Theta is angle between position vector and z axis - G4double wX = m_R[i] * sin(Theta / rad) * cos(Phi / rad) ; - G4double wY = m_R[i] * sin(Theta / rad) * sin(Phi / rad) ; - G4double wZ = m_R[i] * cos(Theta / rad) ; - MMw = G4ThreeVector(wX, wY, wZ) ; + G4double wX = m_R[i] * sin(Theta / rad) * cos(Phi / rad) ; + G4double wY = m_R[i] * sin(Theta / rad) * sin(Phi / rad) ; + G4double wZ = m_R[i] * cos(Theta / rad); + MMw = G4ThreeVector(wX, wY, wZ) ; // vector corresponding to the center of the module G4ThreeVector CT = MMw; @@ -968,127 +965,127 @@ void MUST2Array::ReadSensitive(const G4Event* event) ////////////////////////////////////////////////////////////////////////////////////// // Si - std::map<G4int, G4int*>::iterator DetectorNumber_itr ; - std::map<G4int, G4double*>::iterator Energy_itr ; - std::map<G4int, G4double*>::iterator Time_itr ; - std::map<G4int, G4int*>::iterator X_itr ; - std::map<G4int, G4int*>::iterator Y_itr ; - std::map<G4int, G4double*>::iterator Pos_X_itr ; - std::map<G4int, G4double*>::iterator Pos_Y_itr ; - std::map<G4int, G4double*>::iterator Pos_Z_itr ; - std::map<G4int, G4double*>::iterator Ang_Theta_itr ; - std::map<G4int, G4double*>::iterator Ang_Phi_itr ; + std::map<G4int, G4int*>::iterator DetectorNumber_itr; + std::map<G4int, G4double*>::iterator Energy_itr; + std::map<G4int, G4double*>::iterator Time_itr; + std::map<G4int, G4int*>::iterator X_itr; + std::map<G4int, G4int*>::iterator Y_itr; + std::map<G4int, G4double*>::iterator Pos_X_itr; + std::map<G4int, G4double*>::iterator Pos_Y_itr; + std::map<G4int, G4double*>::iterator Pos_Z_itr; + std::map<G4int, G4double*>::iterator Ang_Theta_itr; + std::map<G4int, G4double*>::iterator Ang_Phi_itr; - G4THitsMap<G4int>* DetectorNumberHitMap ; - G4THitsMap<G4double>* EnergyHitMap ; - G4THitsMap<G4double>* TimeHitMap ; - G4THitsMap<G4int>* XHitMap ; - G4THitsMap<G4int>* YHitMap ; - G4THitsMap<G4double>* PosXHitMap ; - G4THitsMap<G4double>* PosYHitMap ; - G4THitsMap<G4double>* PosZHitMap ; - G4THitsMap<G4double>* AngThetaHitMap ; - G4THitsMap<G4double>* AngPhiHitMap ; + G4THitsMap<G4int>* DetectorNumberHitMap; + G4THitsMap<G4double>* EnergyHitMap; + G4THitsMap<G4double>* TimeHitMap; + G4THitsMap<G4int>* XHitMap; + G4THitsMap<G4int>* YHitMap; + G4THitsMap<G4double>* PosXHitMap; + G4THitsMap<G4double>* PosYHitMap; + G4THitsMap<G4double>* PosZHitMap; + G4THitsMap<G4double>* AngThetaHitMap; + G4THitsMap<G4double>* AngPhiHitMap; // Si(Li) - std::map<G4int, G4double*>::iterator SiLiEnergy_itr ; - std::map<G4int, G4int*>::iterator SiLiPadNbr_itr ; - G4THitsMap<G4double>* SiLiEnergyHitMap ; - G4THitsMap<G4int>* SiLiPadNbrHitMap ; + std::map<G4int, G4double*>::iterator SiLiEnergy_itr; + std::map<G4int, G4int*>::iterator SiLiPadNbr_itr; + G4THitsMap<G4double>* SiLiEnergyHitMap; + G4THitsMap<G4int>* SiLiPadNbrHitMap; // CsI - std::map<G4int, G4double*>::iterator CsIEnergy_itr ; - std::map<G4int, G4int*>::iterator CsICristalNbr_itr ; - G4THitsMap<G4double>* CsIEnergyHitMap ; - G4THitsMap<G4int>* CsICristalNbrHitMap ; + std::map<G4int, G4double*>::iterator CsIEnergy_itr; + std::map<G4int, G4int*>::iterator CsICristalNbr_itr; + G4THitsMap<G4double>* CsIEnergyHitMap; + G4THitsMap<G4int>* CsICristalNbrHitMap; ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// // Read the Scorer associate to the Silicon Strip //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/DetectorNumber") ; - DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; + G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/DetectorNumber"); + DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)); + DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin(); //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripEnergy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; + G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripEnergy") ; + EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; + Energy_itr = EnergyHitMap->GetMap()->begin(); //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripTime") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; + G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripTime"); + TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)); + Time_itr = TimeHitMap->GetMap()->begin(); //Strip Number X - G4int StripXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripNumberX") ; - XHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripXCollectionID)) ; - X_itr = XHitMap->GetMap()->begin() ; + G4int StripXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripNumberX") ; + XHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripXCollectionID)); + X_itr = XHitMap->GetMap()->begin(); //Strip Number Y - G4int StripYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripNumberY") ; - YHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripYCollectionID)) ; - Y_itr = YHitMap->GetMap()->begin() ; + G4int StripYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/StripNumberY"); + YHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripYCollectionID)); + Y_itr = YHitMap->GetMap()->begin(); //Interaction Coordinate X - G4int InterCoordXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordX") ; - PosXHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordXCollectionID)) ; - Pos_X_itr = PosXHitMap->GetMap()->begin() ; + G4int InterCoordXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordX"); + PosXHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordXCollectionID)); + Pos_X_itr = PosXHitMap->GetMap()->begin(); //Interaction Coordinate Y - G4int InterCoordYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordY") ; - PosYHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordYCollectionID)) ; - Pos_Y_itr = PosYHitMap->GetMap()->begin() ; + G4int InterCoordYCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordY"); + PosYHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordYCollectionID)); + Pos_Y_itr = PosYHitMap->GetMap()->begin(); //Interaction Coordinate Z - G4int InterCoordZCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordZ") ; - PosZHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordZCollectionID)) ; - Pos_Z_itr = PosXHitMap->GetMap()->begin() ; + G4int InterCoordZCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordZ"); + PosZHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordZCollectionID)); + Pos_Z_itr = PosXHitMap->GetMap()->begin(); //Interaction Coordinate Angle Theta G4int InterCoordAngThetaCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordAngTheta"); - AngThetaHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngThetaCollectionID)) ; - Ang_Theta_itr = AngThetaHitMap->GetMap()->begin() ; + AngThetaHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngThetaCollectionID)); + Ang_Theta_itr = AngThetaHitMap->GetMap()->begin(); //Interaction Coordinate Angle Phi - G4int InterCoordAngPhiCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordAngPhi") ; - AngPhiHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngPhiCollectionID)) ; - Ang_Phi_itr = AngPhiHitMap->GetMap()->begin() ; + G4int InterCoordAngPhiCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_StripScorer/InterCoordAngPhi"); + AngPhiHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(InterCoordAngPhiCollectionID)); + Ang_Phi_itr = AngPhiHitMap->GetMap()->begin(); // Read the Scorer associate to the SiLi //Energy - G4int SiLiEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_SiLiScorer/SiLiEnergy") ; - SiLiEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(SiLiEnergyCollectionID)) ; - SiLiEnergy_itr = SiLiEnergyHitMap->GetMap()->begin() ; + G4int SiLiEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_SiLiScorer/SiLiEnergy"); + SiLiEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(SiLiEnergyCollectionID)); + SiLiEnergy_itr = SiLiEnergyHitMap->GetMap()->begin(); - G4int SiLiPadNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_SiLiScorer/SiLiPadNbr") ; - SiLiPadNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(SiLiPadNbrCollectionID)) ; - SiLiPadNbr_itr = SiLiPadNbrHitMap->GetMap()->begin() ; + G4int SiLiPadNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_SiLiScorer/SiLiPadNbr"); + SiLiPadNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(SiLiPadNbrCollectionID)); + SiLiPadNbr_itr = SiLiPadNbrHitMap->GetMap()->begin(); // Read the Scorer associate to the CsI crystal //Energy - G4int CsIEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_CsIScorer/CsIEnergy") ; - CsIEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(CsIEnergyCollectionID)) ; - CsIEnergy_itr = CsIEnergyHitMap->GetMap()->begin() ; + G4int CsIEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_CsIScorer/CsIEnergy"); + CsIEnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(CsIEnergyCollectionID)); + CsIEnergy_itr = CsIEnergyHitMap->GetMap()->begin(); - G4int CsICristalNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_CsIScorer/CsICristalNbr") ; - CsICristalNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(CsICristalNbrCollectionID)) ; - CsICristalNbr_itr = CsICristalNbrHitMap->GetMap()->begin() ; + G4int CsICristalNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("MUST2_CsIScorer/CsICristalNbr"); + CsICristalNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(CsICristalNbrCollectionID)); + CsICristalNbr_itr = CsICristalNbrHitMap->GetMap()->begin(); ///////////////////// - G4int sizeN = DetectorNumberHitMap->entries() ; - G4int sizeE = EnergyHitMap->entries() ; - G4int sizeT = TimeHitMap->entries() ; - G4int sizeX = XHitMap->entries() ; - G4int sizeY = YHitMap->entries() ; + G4int sizeN = DetectorNumberHitMap->entries(); + G4int sizeE = EnergyHitMap->entries(); + G4int sizeT = TimeHitMap->entries(); + G4int sizeX = XHitMap->entries(); + G4int sizeY = YHitMap->entries(); // Loop on Telescope Number entry for (G4int l = 0 ; l < sizeN ; l++) { - G4int N = *(DetectorNumber_itr->second) ; - G4int NTrackID = DetectorNumber_itr->first - N ; + G4int N = *(DetectorNumber_itr->second); + G4int NTrackID = DetectorNumber_itr->first - N; if (N > 0) { @@ -1101,12 +1098,12 @@ void MUST2Array::ReadSensitive(const G4Event* event) // Energy Energy_itr = EnergyHitMap->GetMap()->begin(); for (G4int h = 0 ; h < sizeE ; h++) { - G4int ETrackID = Energy_itr->first - N ; - G4double E = *(Energy_itr->second) ; + G4int ETrackID = Energy_itr->first - N; + G4double E = *(Energy_itr->second); if (ETrackID == NTrackID) { - m_Event->SetMMStripXEEnergy(RandGauss::shoot(E, ResoStrip)) ; - m_Event->SetMMStripYEEnergy(RandGauss::shoot(E, ResoStrip)) ; + m_Event->SetMMStripXEEnergy(RandGauss::shoot(E, ResoStrip)); + m_Event->SetMMStripYEEnergy(RandGauss::shoot(E, ResoStrip)); } Energy_itr++; @@ -1116,8 +1113,8 @@ void MUST2Array::ReadSensitive(const G4Event* event) // Time Time_itr = TimeHitMap->GetMap()->begin(); for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N ; - G4double T = *(Time_itr->second) ; + G4int TTrackID = Time_itr->first - N; + G4double T = *(Time_itr->second); if (TTrackID == NTrackID) { m_Event->SetMMStripXTTime(RandGauss::shoot(T, ResoTimeMust)) ; @@ -1131,11 +1128,11 @@ void MUST2Array::ReadSensitive(const G4Event* event) // X X_itr = XHitMap->GetMap()->begin(); for (G4int h = 0 ; h < sizeX ; h++) { - G4int XTrackID = X_itr->first - N ; - G4int X = *(X_itr->second) ; + G4int XTrackID = X_itr->first - N; + G4int X = *(X_itr->second); if (XTrackID == NTrackID) { - m_Event->SetMMStripXEStripNbr(X) ; - m_Event->SetMMStripXTStripNbr(X) ; + m_Event->SetMMStripXEStripNbr(X); + m_Event->SetMMStripXTStripNbr(X); } X_itr++; @@ -1144,11 +1141,11 @@ void MUST2Array::ReadSensitive(const G4Event* event) // Y Y_itr = YHitMap->GetMap()->begin() ; for (G4int h = 0 ; h < sizeY ; h++) { - G4int YTrackID = Y_itr->first - N ; - G4int Y = *(Y_itr->second) ; + G4int YTrackID = Y_itr->first - N ; + G4int Y = *(Y_itr->second); if (YTrackID == NTrackID) { - m_Event->SetMMStripYEStripNbr(Y) ; - m_Event->SetMMStripYTStripNbr(Y) ; + m_Event->SetMMStripYEStripNbr(Y); + m_Event->SetMMStripYTStripNbr(Y); } Y_itr++; @@ -1157,8 +1154,8 @@ void MUST2Array::ReadSensitive(const G4Event* event) // Pos X Pos_X_itr = PosXHitMap->GetMap()->begin(); for (G4int h = 0 ; h < PosXHitMap->entries() ; h++) { - G4int PosXTrackID = Pos_X_itr->first - N ; - G4double PosX = *(Pos_X_itr->second) ; + G4int PosXTrackID = Pos_X_itr->first - N ; + G4double PosX = *(Pos_X_itr->second) ; if (PosXTrackID == NTrackID) { ms_InterCoord->SetDetectedPositionX(PosX) ; } @@ -1168,8 +1165,8 @@ void MUST2Array::ReadSensitive(const G4Event* event) // Pos Y Pos_Y_itr = PosYHitMap->GetMap()->begin(); for (G4int h = 0 ; h < PosYHitMap->entries() ; h++) { - G4int PosYTrackID = Pos_Y_itr->first - N ; - G4double PosY = *(Pos_Y_itr->second) ; + G4int PosYTrackID = Pos_Y_itr->first - N ; + G4double PosY = *(Pos_Y_itr->second) ; if (PosYTrackID == NTrackID) { ms_InterCoord->SetDetectedPositionY(PosY) ; } @@ -1264,20 +1261,20 @@ void MUST2Array::ReadSensitive(const G4Event* event) } // clear map for next event - DetectorNumberHitMap ->clear() ; - EnergyHitMap ->clear() ; - TimeHitMap ->clear() ; - XHitMap ->clear() ; - YHitMap ->clear() ; + DetectorNumberHitMap ->clear(); + EnergyHitMap ->clear() ; + TimeHitMap ->clear() ; + XHitMap ->clear() ; + YHitMap ->clear() ; SiLiEnergyHitMap ->clear() ; SiLiPadNbrHitMap ->clear() ; - CsIEnergyHitMap ->clear() ; + CsIEnergyHitMap ->clear() ; CsICristalNbrHitMap ->clear() ; - PosXHitMap ->clear() ; - PosYHitMap ->clear() ; - PosZHitMap ->clear() ; - AngThetaHitMap ->clear() ; - AngPhiHitMap ->clear() ; + PosXHitMap ->clear() ; + PosYHitMap ->clear() ; + PosZHitMap ->clear() ; + AngThetaHitMap ->clear() ; + AngPhiHitMap ->clear() ; } @@ -1288,56 +1285,52 @@ void MUST2Array::InitializeScorers() // Silicon Associate Scorer m_StripScorer = new G4MultiFunctionalDetector("MUST2_StripScorer"); - G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber","MUST2Telescope", 0) ; - G4VPrimitiveScorer* Energy = new GENERALSCORERS::PSEnergy("StripEnergy","MUST2Telescope", 0) ; - G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","MUST2Telescope", 0) ; + G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber","MUST2Telescope", 0); + G4VPrimitiveScorer* Energy = new GENERALSCORERS::PSEnergy("StripEnergy","MUST2Telescope", 0); + G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","MUST2Telescope", 0); - G4VPrimitiveScorer* StripPositionX = new PSStripNumberX("StripNumberX", 0, SiliconFace, 128) ; - G4VPrimitiveScorer* StripPositionY = new PSStripNumberY("StripNumberY", 0, SiliconFace, 128) ; - - G4VPrimitiveScorer* InteractionCoordinatesX = new GENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","MUST2Telescope", 0) ; - G4VPrimitiveScorer* InteractionCoordinatesY = new GENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","MUST2Telescope", 0) ; - G4VPrimitiveScorer* InteractionCoordinatesZ = new GENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","MUST2Telescope", 0) ; - G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new GENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","MUST2Telescope", 0) ; - G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new GENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","MUST2Telescope", 0) ; + G4VPrimitiveScorer* StripPositionX = new PSStripNumberX("StripNumberX", 0, SiliconFace, 128); + G4VPrimitiveScorer* StripPositionY = new PSStripNumberY("StripNumberY", 0, SiliconFace, 128); + + G4VPrimitiveScorer* InteractionCoordinatesX = new GENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","MUST2Telescope", 0); + G4VPrimitiveScorer* InteractionCoordinatesY = new GENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","MUST2Telescope", 0); + G4VPrimitiveScorer* InteractionCoordinatesZ = new GENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","MUST2Telescope", 0); + G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new GENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","MUST2Telescope", 0); + G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new GENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","MUST2Telescope", 0) ; //and register it to the multifunctionnal detector - m_StripScorer->RegisterPrimitive(DetNbr) ; - m_StripScorer->RegisterPrimitive(Energy) ; - m_StripScorer->RegisterPrimitive(TOF) ; - m_StripScorer->RegisterPrimitive(StripPositionX) ; - m_StripScorer->RegisterPrimitive(StripPositionY) ; - m_StripScorer->RegisterPrimitive(InteractionCoordinatesX) ; - m_StripScorer->RegisterPrimitive(InteractionCoordinatesY) ; - m_StripScorer->RegisterPrimitive(InteractionCoordinatesZ) ; - m_StripScorer->RegisterPrimitive(InteractionCoordinatesAngleTheta) ; - m_StripScorer->RegisterPrimitive(InteractionCoordinatesAnglePhi) ; + m_StripScorer->RegisterPrimitive(DetNbr); + m_StripScorer->RegisterPrimitive(Energy); + m_StripScorer->RegisterPrimitive(TOF); + m_StripScorer->RegisterPrimitive(StripPositionX); + m_StripScorer->RegisterPrimitive(StripPositionY); + m_StripScorer->RegisterPrimitive(InteractionCoordinatesX); + m_StripScorer->RegisterPrimitive(InteractionCoordinatesY); + m_StripScorer->RegisterPrimitive(InteractionCoordinatesZ); + m_StripScorer->RegisterPrimitive(InteractionCoordinatesAngleTheta); + m_StripScorer->RegisterPrimitive(InteractionCoordinatesAnglePhi); // SiLi Associate Scorer - m_SiLiScorer = new G4MultiFunctionalDetector("MUST2_SiLiScorer") ; - G4VPrimitiveScorer* SiLiEnergy = new GENERALSCORERS::PSEnergy("SiLiEnergy","MUST2Telescope", 0) ; - G4VPrimitiveScorer* SiLiPadNbr = new PSPadOrCristalNumber("SiLiPadNbr",0) ; - m_SiLiScorer->RegisterPrimitive(SiLiEnergy) ; - m_SiLiScorer->RegisterPrimitive(SiLiPadNbr) ; + m_SiLiScorer = new G4MultiFunctionalDetector("MUST2_SiLiScorer"); + G4VPrimitiveScorer* SiLiEnergy = new GENERALSCORERS::PSEnergy("SiLiEnergy","MUST2Telescope", 0) ; + G4VPrimitiveScorer* SiLiPadNbr = new PSPadOrCristalNumber("SiLiPadNbr",0) ; + m_SiLiScorer->RegisterPrimitive(SiLiEnergy); + m_SiLiScorer->RegisterPrimitive(SiLiPadNbr); // CsI Associate Scorer - m_CsIScorer = new G4MultiFunctionalDetector("MUST2_CsIScorer") ; - G4VPrimitiveScorer* CsIEnergy = new GENERALSCORERS::PSEnergy("CsIEnergy","MUST2Telescope", 0) ; + m_CsIScorer = new G4MultiFunctionalDetector("MUST2_CsIScorer"); + G4VPrimitiveScorer* CsIEnergy = new GENERALSCORERS::PSEnergy("CsIEnergy","MUST2Telescope", 0) ; G4VPrimitiveScorer* CsICristalNbr = new PSPadOrCristalNumber("CsICristalNbr",0) ; - m_CsIScorer->RegisterPrimitive(CsIEnergy) ; - m_CsIScorer->RegisterPrimitive(CsICristalNbr) ; + m_CsIScorer->RegisterPrimitive(CsIEnergy) ; + m_CsIScorer->RegisterPrimitive(CsICristalNbr) ; // Add All Scorer to the Global Scorer Manager G4SDManager::GetSDMpointer()->AddNewDetector(m_StripScorer) ; - G4SDManager::GetSDMpointer()->AddNewDetector(m_SiLiScorer) ; - G4SDManager::GetSDMpointer()->AddNewDetector(m_CsIScorer) ; - - + G4SDManager::GetSDMpointer()->AddNewDetector(m_SiLiScorer) ; + G4SDManager::GetSDMpointer()->AddNewDetector(m_CsIScorer) ; } - - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void MUST2Array::InitializeMaterial() { diff --git a/NPSimulation/src/Must2Scorers.cc b/NPSimulation/src/Must2Scorers.cc index 0493519a3..d5551cdd9 100644 --- a/NPSimulation/src/Must2Scorers.cc +++ b/NPSimulation/src/Must2Scorers.cc @@ -37,7 +37,7 @@ PSStripNumberX::PSStripNumberX(G4String name, G4int depth, G4double StripPlaneSi { m_StripPlaneSize = StripPlaneSize ; m_NumberOfStrip = NumberOfStrip ; - m_StripPitch = m_StripPlaneSize / m_NumberOfStrip; + m_StripPitch = m_StripPlaneSize / m_NumberOfStrip; } PSStripNumberX::~PSStripNumberX() @@ -47,7 +47,7 @@ PSStripNumberX::~PSStripNumberX() G4bool PSStripNumberX::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "MUST2Telescope"); + int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "MUST2Telescope"); G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); @@ -102,7 +102,7 @@ PSStripNumberY::PSStripNumberY(G4String name, G4int depth, G4double StripPlaneSi { m_StripPlaneSize = StripPlaneSize ; m_NumberOfStrip = NumberOfStrip ; - m_StripPitch = m_StripPlaneSize / m_NumberOfStrip; + m_StripPitch = m_StripPlaneSize / m_NumberOfStrip; } PSStripNumberY::~PSStripNumberY() @@ -112,7 +112,7 @@ PSStripNumberY::~PSStripNumberY() G4bool PSStripNumberY::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "MUST2Telescope"); + int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "MUST2Telescope"); G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); @@ -180,30 +180,30 @@ PSPadOrCristalNumber::~PSPadOrCristalNumber() G4bool PSPadOrCristalNumber::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - std::string name = aStep->GetTrack()->GetVolume()->GetName(); - std::string nbr ; - - G4int temp1,temp2 ; - G4int VolumeNumber; - nbr = name[name.length()-1] ; - temp1 = atoi( nbr.c_str() ) ; - - nbr = name[name.length()-2] ; - temp2 = atoi( nbr.c_str() ) ; - - nbr.clear(); - - if(temp2!=0) { nbr+= name[name.length()-2] ; nbr+= name[name.length()-1] ; VolumeNumber = atoi( nbr.c_str() ) ;} - - else { nbr= name[name.length()-1] ; VolumeNumber = atoi( nbr.c_str() ) ;} - - G4int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "MUST2Telescope"); - - G4double edep = aStep->GetTotalEnergyDeposit(); - if (edep < 100*keV) return FALSE; - G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(index+DetNbr, VolumeNumber); - return TRUE; + std::string name = aStep->GetTrack()->GetVolume()->GetName(); + std::string nbr ; + + G4int temp1,temp2 ; + G4int VolumeNumber; + nbr = name[name.length()-1] ; + temp1 = atoi( nbr.c_str() ) ; + + nbr = name[name.length()-2] ; + temp2 = atoi( nbr.c_str() ) ; + + nbr.clear(); + + if(temp2!=0) { nbr+= name[name.length()-2] ; nbr+= name[name.length()-1] ; VolumeNumber = atoi( nbr.c_str() ) ;} + + else { nbr= name[name.length()-1] ; VolumeNumber = atoi( nbr.c_str() ) ;} + + G4int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "MUST2Telescope"); + + G4double edep = aStep->GetTotalEnergyDeposit(); + if (edep < 100*keV) return FALSE; + G4int index = aStep->GetTrack()->GetTrackID(); + EvtMap->set(index+DetNbr, VolumeNumber); + return TRUE; } void PSPadOrCristalNumber::Initialize(G4HCofThisEvent* HCE) diff --git a/NPSimulation/src/ParisCluster.cc b/NPSimulation/src/ParisCluster.cc index 3ff1f1c10..c80d9b9c4 100644 --- a/NPSimulation/src/ParisCluster.cc +++ b/NPSimulation/src/ParisCluster.cc @@ -400,7 +400,7 @@ void ParisCluster::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -512,11 +512,11 @@ void ParisCluster::ReadConfiguration(string Path) if ((check_A && check_B && check_C && check_D && checkVis) && !(check_Theta && check_Phi && check_R)) { ReadingStatus = false; - check_A = false; - check_C = false; - check_B = false; - check_D = false; - checkVis = false; + check_A = false; + check_C = false; + check_B = false; + check_D = false; + checkVis = false; AddModule(A, B, C, D); } @@ -526,11 +526,11 @@ void ParisCluster::ReadConfiguration(string Path) !(check_A && check_B && check_C && check_D)) { ReadingStatus = false; check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - checkVis = false; - + check_Phi = false; + check_R = false; + check_beta = false; + checkVis = false; + AddModule(R, Theta, Phi, beta_u, beta_v, beta_w); } } @@ -772,8 +772,8 @@ void ParisCluster::ReadSensitive(const G4Event* event) G4int sizeNCsI= CsIDetectorNumberHitMap->entries(); G4int sizeECsI= CsIStageEnergyHitMap->entries(); - sizeC *= 1; // remove warning at compilation - sizeECsI *= 1; // remove warning at compilation + sizeC *= 1; // remove warning at compilation + sizeECsI *= 1; // remove warning at compilation //G4cout <<"SizeN=" << sizeN << endl; //G4cout <<"SizeC=" << sizeC << endl; //G4cout <<"SizeN CsI =" << sizeNCsI << endl; @@ -806,7 +806,7 @@ void ParisCluster::ReadSensitive(const G4Event* event) G4double T = *(Time_itr->second); G4int NCryst= *(CrystalNumber_itr->second); - NCryst *= 1; //remove warning at compilation + NCryst *= 1; //remove warning at compilation //G4cout <<"NTrackID=" << NTrackID << G4endl; //G4cout <<"N_first=" << N_first << G4endl; //G4cout <<"CrystalNumber_first=" << NCryst << G4endl; @@ -815,92 +815,92 @@ void ParisCluster::ReadSensitive(const G4Event* event) if(sizeN>1) - { - Energy_itr++; - Time_itr++; - CrystalNumber_itr++; - DetectorNumber_itr++; + { + Energy_itr++; + Time_itr++; + CrystalNumber_itr++; + DetectorNumber_itr++; - for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks + for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks - G4int N= *(DetectorNumber_itr->second); // ID of det hit - NTrackID = DetectorNumber_itr->first - N; // ID of the track + G4int N= *(DetectorNumber_itr->second); // ID of det hit + NTrackID = DetectorNumber_itr->first - N; // ID of the track - //G4cout <<"l=" << l << G4endl; - //G4cout <<"N=" << N << G4endl; - //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; - //G4cout <<"NTrackID=" << NTrackID << G4endl; + //G4cout <<"l=" << l << G4endl; + //G4cout <<"N=" << N << G4endl; + //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; + //G4cout <<"NTrackID=" << NTrackID << G4endl; - if(N==N_first) - { - E += *(Energy_itr->second); + if(N==N_first) + { + E += *(Energy_itr->second); - }else // we fill the tree for the first detector hit and move to the next detector hit - { - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Cluster"] + N_first); - ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Cluster"] + N_first); - // Fill Energy - //ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); + }else // we fill the tree for the first detector hit and move to the next detector hit + { + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Cluster"] + N_first); + ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Cluster"] + N_first); + // Fill Energy + //ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); - // Fill Time - ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); + // Fill Time + ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); - } + } - N_first=N; - E=*(Energy_itr->second); + N_first=N; + E=*(Energy_itr->second); - } + } - //G4cout <<"Energy=" << E << G4endl; - //G4cout <<"Time =" << T << G4endl; + //G4cout <<"Energy=" << E << G4endl; + //G4cout <<"Time =" << T << G4endl; - // Always fill the tree at the end of the loop: - if(l==(sizeN-1) && E!=0) - { - // Fill detector number - ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Cluster"] + N_first); - ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Cluster"] + N_first); - // Fill Energy - //ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); - - // Fill Time - ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - - Energy_itr++; - DetectorNumber_itr++; - } - }else - { - // Fill the tree if sizeN=1: - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Cluster"] + N_first); - ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Cluster"] + N_first); - // Fill Energy - //ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); - - // Fill Time - ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - } - + // Always fill the tree at the end of the loop: + if(l==(sizeN-1) && E!=0) + { + // Fill detector number + ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Cluster"] + N_first); + ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Cluster"] + N_first); + // Fill Energy + //ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); + + // Fill Time + ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + + Energy_itr++; + DetectorNumber_itr++; + } + }else + { + // Fill the tree if sizeN=1: + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Cluster"] + N_first); + ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Cluster"] + N_first); + // Fill Energy + //ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); + + // Fill Time + ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + } + } @@ -921,87 +921,87 @@ void ParisCluster::ReadSensitive(const G4Event* event) //G4cout <<"CsI Energy first=" << E_CsI << G4endl; if(sizeNCsI>1) - { - CsIDetectorNumber_itr++; - CsIStageEnergy_itr++; + { + CsIDetectorNumber_itr++; + CsIStageEnergy_itr++; - for (G4int l = 1; l < sizeNCsI ; l++) { // loop on all the other tracks + for (G4int l = 1; l < sizeNCsI ; l++) { // loop on all the other tracks - G4int NCsI= *(CsIDetectorNumber_itr->second); // ID of det hit - NCsITrackID = CsIDetectorNumber_itr->first - NCsI; // ID of the track - - //G4cout <<"l=" << l << G4endl; - //G4cout <<"NCsI=" << NCsI << G4endl; - //G4cout <<"DetectorNumber_itr->first =" << CsIDetectorNumber_itr->first << G4endl; - //G4cout <<"NCsITrackID=" << NCsITrackID << G4endl; - - if(NCsI==NCsI_first) - { - - E_CsI += *(CsIStageEnergy_itr->second); - - }else // we fill the tree for the first detector hit and move to the next detector hit - { - if(E_CsI!=0) - { - // Fill detector number - ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Cluster"] + NCsI_first); - ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Cluster"] + NCsI_first); - // Fill Energy - // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); - E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); - ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree - if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); - - // Fill Time - //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); - } - - NCsI_first=NCsI; - E_CsI=*(CsIStageEnergy_itr->second); - } - - //G4cout <<"Energy_CsI=" << E_CsI << G4endl; - - // Always fill the tree at the end of the loop: + G4int NCsI= *(CsIDetectorNumber_itr->second); // ID of det hit + NCsITrackID = CsIDetectorNumber_itr->first - NCsI; // ID of the track + + //G4cout <<"l=" << l << G4endl; + //G4cout <<"NCsI=" << NCsI << G4endl; + //G4cout <<"DetectorNumber_itr->first =" << CsIDetectorNumber_itr->first << G4endl; + //G4cout <<"NCsITrackID=" << NCsITrackID << G4endl; + + if(NCsI==NCsI_first) + { + + E_CsI += *(CsIStageEnergy_itr->second); + + }else // we fill the tree for the first detector hit and move to the next detector hit + { + if(E_CsI!=0) + { + // Fill detector number + ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Cluster"] + NCsI_first); + ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Cluster"] + NCsI_first); + // Fill Energy + // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); + E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); + ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree + if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); + + // Fill Time + //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); + } + + NCsI_first=NCsI; + E_CsI=*(CsIStageEnergy_itr->second); + } + + //G4cout <<"Energy_CsI=" << E_CsI << G4endl; + + // Always fill the tree at the end of the loop: - if(l==(sizeNCsI-1) && E_CsI!=0) - { - // Fill detector number - ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Cluster"] + NCsI_first); - ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Cluster"] + NCsI_first); - // Fill Energy - // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); - E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); - ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree - if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); - // Fill Time - //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); - - } - - CsIStageEnergy_itr++; - CsIDetectorNumber_itr++; - } - - }else - { - // Fill the tree if sizeN=1: - if(E_CsI!=0) - { - // Fill detector number - ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Cluster"] + NCsI_first); - ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Cluster"] + NCsI_first); - // Fill Energy - // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); - E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); - ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree - if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); - // Fill Time - //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); - } - } + if(l==(sizeNCsI-1) && E_CsI!=0) + { + // Fill detector number + ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Cluster"] + NCsI_first); + ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Cluster"] + NCsI_first); + // Fill Energy + // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); + E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); + ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree + if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); + // Fill Time + //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); + + } + + CsIStageEnergy_itr++; + CsIDetectorNumber_itr++; + } + + }else + { + // Fill the tree if sizeN=1: + if(E_CsI!=0) + { + // Fill detector number + ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Cluster"] + NCsI_first); + ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Cluster"] + NCsI_first); + // Fill Energy + // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); + E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); + ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree + if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); + // Fill Time + //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); + } + } } diff --git a/NPSimulation/src/ParisPhoswich.cc b/NPSimulation/src/ParisPhoswich.cc index a0a956a81..14ef9081c 100644 --- a/NPSimulation/src/ParisPhoswich.cc +++ b/NPSimulation/src/ParisPhoswich.cc @@ -311,7 +311,7 @@ void ParisPhoswich::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -422,12 +422,12 @@ void ParisPhoswich::ReadConfiguration(string Path) // With position method if ((check_A && check_B && check_C && check_D && checkVis) && !(check_Theta && check_Phi && check_R)) { - ReadingStatus = false; - check_A = false; - check_C = false; - check_B = false; - check_D = false; - checkVis = false; + ReadingStatus = false; + check_A = false; + check_C = false; + check_B = false; + check_D = false; + checkVis = false; AddModule(A, B, C, D); } @@ -435,13 +435,13 @@ void ParisPhoswich::ReadConfiguration(string Path) // With angle method if ((check_Theta && check_Phi && check_R && checkVis) && !(check_A && check_B && check_C && check_D)) { - ReadingStatus = false; - check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - checkVis = false; - + ReadingStatus = false; + check_Theta = false; + check_Phi = false; + check_R = false; + check_beta = false; + checkVis = false; + AddModule(R, Theta, Phi, beta_u, beta_v, beta_w); } } @@ -684,15 +684,15 @@ void ParisPhoswich::ReadSensitive(const G4Event* event) G4int sizeNCsI= CsIDetectorNumberHitMap->entries(); G4int sizeECsI= CsIStageEnergyHitMap->entries(); - sizeC *= 1; // remove warning at compilation - sizeECsI *= 1; // remove warning at compilation + sizeC *= 1; // remove warning at compilation + sizeECsI *= 1; // remove warning at compilation //G4cout <<"SizeN=" << sizeN << endl; //G4cout <<"SizeC=" << sizeC << endl; //G4cout <<"SizeN CsI =" << sizeNCsI << endl; //G4cout <<"SizeE CsI =" << sizeECsI << endl; //DetectorNumberHitMap->PrintAllHits(); - + if (sizeE != sizeT) { G4cout << "No match size PARIS Event Map: sE:" @@ -717,7 +717,7 @@ void ParisPhoswich::ReadSensitive(const G4Event* event) G4double E = *(Energy_itr->second); G4double T = *(Time_itr->second); G4int NCryst= *(CrystalNumber_itr->second); - NCryst *= 1; // remove warning at compilation + NCryst *= 1; // remove warning at compilation //G4cout <<"NTrackID=" << NTrackID << G4endl; @@ -728,92 +728,92 @@ void ParisPhoswich::ReadSensitive(const G4Event* event) if(sizeN>1) - { - Energy_itr++; - Time_itr++; - CrystalNumber_itr++; - DetectorNumber_itr++; + { + Energy_itr++; + Time_itr++; + CrystalNumber_itr++; + DetectorNumber_itr++; - for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks + for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks - G4int N= *(DetectorNumber_itr->second); // ID of det hit - NTrackID = DetectorNumber_itr->first - N; // ID of the track + G4int N= *(DetectorNumber_itr->second); // ID of det hit + NTrackID = DetectorNumber_itr->first - N; // ID of the track - //G4cout <<"l=" << l << G4endl; - //G4cout <<"N=" << N << G4endl; - //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; - //G4cout <<"NTrackID=" << NTrackID << G4endl; + //G4cout <<"l=" << l << G4endl; + //G4cout <<"N=" << N << G4endl; + //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; + //G4cout <<"NTrackID=" << NTrackID << G4endl; - if(N==N_first) - { - E += *(Energy_itr->second); + if(N==N_first) + { + E += *(Energy_itr->second); - }else // we fill the tree for the first detector hit and move to the next detector hit - { - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Phoswich"] + N_first); - ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Phoswich"] + N_first); - // Fill Energy - // ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); + }else // we fill the tree for the first detector hit and move to the next detector hit + { + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Phoswich"] + N_first); + ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Phoswich"] + N_first); + // Fill Energy + // ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); - // Fill Time - ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); + // Fill Time + ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); - } + } - N_first=N; - E=*(Energy_itr->second); + N_first=N; + E=*(Energy_itr->second); - } + } - //G4cout <<"Energy=" << E << G4endl; - //G4cout <<"Time =" << T << G4endl; + //G4cout <<"Energy=" << E << G4endl; + //G4cout <<"Time =" << T << G4endl; - // Always fill the tree at the end of the loop: - if(l==(sizeN-1) && E!=0) - { - // Fill detector number - ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Phoswich"] + N_first); - ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Phoswich"] + N_first); - // Fill Energy - // ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); - - // Fill Time - ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - - Energy_itr++; - DetectorNumber_itr++; - } - }else - { - // Fill the tree if sizeN=1: - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Phoswich"] + N_first); - ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Phoswich"] + N_first); - // Fill Energy - // ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); - - // Fill Time - ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - } - + // Always fill the tree at the end of the loop: + if(l==(sizeN-1) && E!=0) + { + // Fill detector number + ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Phoswich"] + N_first); + ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Phoswich"] + N_first); + // Fill Energy + // ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); + + // Fill Time + ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + + Energy_itr++; + DetectorNumber_itr++; + } + }else + { + // Fill the tree if sizeN=1: + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISLaBr3StageEDetectorNbr(m_index["Phoswich"] + N_first); + ms_Event->SetPARISLaBr3StageTDetectorNbr(m_index["Phoswich"] + N_first); + // Fill Energy + // ms_Event->SetPARISLaBr3StageEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISLaBr3StageEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax)ms_Event->SetPARISLaBr3StageEffphpeak(EGamma); + + // Fill Time + ms_Event->SetPARISLaBr3StageTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + } + } @@ -835,86 +835,86 @@ void ParisPhoswich::ReadSensitive(const G4Event* event) //G4cout <<"CsI Energy first=" << E_CsI << G4endl; if(sizeNCsI>1) - { - CsIDetectorNumber_itr++; - CsIStageEnergy_itr++; + { + CsIDetectorNumber_itr++; + CsIStageEnergy_itr++; - for (G4int l = 1; l < sizeNCsI ; l++) { // loop on all the other tracks + for (G4int l = 1; l < sizeNCsI ; l++) { // loop on all the other tracks - G4int NCsI= *(CsIDetectorNumber_itr->second); // ID of det hit - NCsITrackID = CsIDetectorNumber_itr->first - NCsI; // ID of the track - - //G4cout <<"l=" << l << G4endl; - //G4cout <<"NCsI=" << NCsI << G4endl; - //G4cout <<"DetectorNumber_itr->first =" << CsIDetectorNumber_itr->first << G4endl; - //G4cout <<"NCsITrackID=" << NCsITrackID << G4endl; - - if(NCsI==NCsI_first) - { - - E_CsI += *(CsIStageEnergy_itr->second); - - }else // we fill the tree for the first detector hit and move to the next detector hit - { - if(E_CsI!=0) - { - // Fill detector number - ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Phoswich"] + NCsI_first); - ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Phoswich"] + NCsI_first); - // Fill Energy - //ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); - E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); - ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree - if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); - // Fill Time - //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); - } - - NCsI_first=NCsI; - E_CsI=*(CsIStageEnergy_itr->second); - } - - //G4cout <<"Energy_CsI=" << E_CsI << G4endl; - - // Always fill the tree at the end of the loop: + G4int NCsI= *(CsIDetectorNumber_itr->second); // ID of det hit + NCsITrackID = CsIDetectorNumber_itr->first - NCsI; // ID of the track + + //G4cout <<"l=" << l << G4endl; + //G4cout <<"NCsI=" << NCsI << G4endl; + //G4cout <<"DetectorNumber_itr->first =" << CsIDetectorNumber_itr->first << G4endl; + //G4cout <<"NCsITrackID=" << NCsITrackID << G4endl; + + if(NCsI==NCsI_first) + { + + E_CsI += *(CsIStageEnergy_itr->second); + + }else // we fill the tree for the first detector hit and move to the next detector hit + { + if(E_CsI!=0) + { + // Fill detector number + ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Phoswich"] + NCsI_first); + ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Phoswich"] + NCsI_first); + // Fill Energy + //ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); + E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); + ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree + if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); + // Fill Time + //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); + } + + NCsI_first=NCsI; + E_CsI=*(CsIStageEnergy_itr->second); + } + + //G4cout <<"Energy_CsI=" << E_CsI << G4endl; + + // Always fill the tree at the end of the loop: - if(l==(sizeNCsI-1) && E_CsI!=0) - { - // Fill detector number - ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Phoswich"] + NCsI_first); - ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Phoswich"] + NCsI_first); - // Fill Energy - // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); - E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); - ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree - if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); - // Fill Time - //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); - - } - - CsIStageEnergy_itr++; - CsIDetectorNumber_itr++; - } - - }else - { - // Fill the tree if sizeN=1: - if(E_CsI!=0) - { - // Fill detector number - ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Phoswich"] + NCsI_first); - ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Phoswich"] + NCsI_first); - // Fill Energy - //ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); - E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); - ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree - if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); - // Fill Time - //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); - } - } + if(l==(sizeNCsI-1) && E_CsI!=0) + { + // Fill detector number + ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Phoswich"] + NCsI_first); + ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Phoswich"] + NCsI_first); + // Fill Energy + // ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); + E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); + ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree + if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); + // Fill Time + //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); + + } + + CsIStageEnergy_itr++; + CsIDetectorNumber_itr++; + } + + }else + { + // Fill the tree if sizeN=1: + if(E_CsI!=0) + { + // Fill detector number + ms_Event->SetPARISCsIStageEDetectorNbr(m_index["Phoswich"] + NCsI_first); + ms_Event->SetPARISCsIStageTDetectorNbr(m_index["Phoswich"] + NCsI_first); + // Fill Energy + //ms_Event->SetPARISCsIStageEEnergy(RandGauss::shoot(E_CsI, ResoSecondStage)); + E_CsI=RandGauss::shoot(E_CsI, ResoSecondStage); + ms_Event->SetPARISCsIStageEEnergy(E_CsI); // Fill the tree + if(E_CsI>EGammaMin && E_CsI<EGammaMax)ms_Event->SetPARISCsIStageEffphpeak(EGamma); + // Fill Time + //ms_Event->SetPARISCsIStageTTime(RandGauss::shoot(T_CsI, ResoTimeGpd)); + } + } } diff --git a/NPSimulation/src/PhysicsList.cc b/NPSimulation/src/PhysicsList.cc index 464c52a63..d96cdcab8 100644 --- a/NPSimulation/src/PhysicsList.cc +++ b/NPSimulation/src/PhysicsList.cc @@ -98,8 +98,8 @@ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... PhysicsList::PhysicsList() -{ - // ie: no secondaries +{ + // ie: no secondaries defaultCutValue = 1000 * pc; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -213,16 +213,16 @@ void PhysicsList::ConstructEM() if (particleName == "gamma") { // gamma - //standard Geant4 - pmanager->AddDiscreteProcess(new G4PhotoElectricEffect) ; + //standard Geant4 + pmanager->AddDiscreteProcess(new G4PhotoElectricEffect) ; pmanager->AddDiscreteProcess(new G4ComptonScattering) ; - pmanager->AddDiscreteProcess(new G4GammaConversion) ; - //Low energy - //pmanager->AddDiscreteProcess(new G4LowEnergyPhotoElectric) ; + pmanager->AddDiscreteProcess(new G4GammaConversion) ; + //Low energy + //pmanager->AddDiscreteProcess(new G4LowEnergyPhotoElectric) ; //pmanager->AddDiscreteProcess(new G4LowEnergyCompton) ; //pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion) ; //pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh) ; - // Penelope + // Penelope //pmanager->AddDiscreteProcess(new G4PenelopePhotoElectric) ; //pmanager->AddDiscreteProcess(new G4PenelopeCompton) ; //pmanager->AddDiscreteProcess(new G4PenelopeGammaConversion) ; @@ -231,28 +231,28 @@ void PhysicsList::ConstructEM() } else if (particleName == "e-") { //electron pmanager->AddProcess(new G4MultipleScattering , -1, 1, 1) ; - //standard geant4: - pmanager->AddProcess(new G4eIonisation , -1, 2, 2) ; - pmanager->AddProcess(new G4eBremsstrahlung , -1, -1, 3) ; - // Low energy: - //pmanager->AddProcess(new G4LowEnergyIonisation , -1, 2, 2) ; - //pmanager->AddProcess(new G4LowEnergyBremsstrahlung , -1, -1, 3) ; - // Penelope: - // pmanager->AddProcess(new G4PenelopeIonisation , -1, 2, 2) ; - // pmanager->AddProcess(new G4PenelopeBremsstrahlung , -1, -1, 3) ; + //standard geant4: + pmanager->AddProcess(new G4eIonisation , -1, 2, 2) ; + pmanager->AddProcess(new G4eBremsstrahlung , -1, -1, 3) ; + // Low energy: + //pmanager->AddProcess(new G4LowEnergyIonisation , -1, 2, 2) ; + //pmanager->AddProcess(new G4LowEnergyBremsstrahlung , -1, -1, 3) ; + // Penelope: + // pmanager->AddProcess(new G4PenelopeIonisation , -1, 2, 2) ; + // pmanager->AddProcess(new G4PenelopeBremsstrahlung , -1, -1, 3) ; } else if (particleName == "e+") { //positron - pmanager->AddProcess(new G4MultipleScattering , -1, 1, 1 ); - // standard Geant4 and Low energy - pmanager->AddProcess(new G4eIonisation , -1, 2, 2 ); - pmanager->AddProcess(new G4eBremsstrahlung , -1, -1, 3 ); - pmanager->AddProcess(new G4eplusAnnihilation , 0, -1, 4 ); - //Penelope: - //pmanager->AddProcess(new G4PenelopeIonisation , -1, 2, 2 ); - //pmanager->AddProcess(new G4PenelopeBremsstrahlung , -1, -1, 3 ); - //pmanager->AddProcess(new G4PenelopeAnnihilation , 0, -1, 4 ); + pmanager->AddProcess(new G4MultipleScattering , -1, 1, 1 ); + // standard Geant4 and Low energy + pmanager->AddProcess(new G4eIonisation , -1, 2, 2 ); + pmanager->AddProcess(new G4eBremsstrahlung , -1, -1, 3 ); + pmanager->AddProcess(new G4eplusAnnihilation , 0, -1, 4 ); + //Penelope: + //pmanager->AddProcess(new G4PenelopeIonisation , -1, 2, 2 ); + //pmanager->AddProcess(new G4PenelopeBremsstrahlung , -1, -1, 3 ); + //pmanager->AddProcess(new G4PenelopeAnnihilation , 0, -1, 4 ); diff --git a/NPSimulation/src/Plastic.cc b/NPSimulation/src/Plastic.cc index a8ea86188..38af5fda4 100644 --- a/NPSimulation/src/Plastic.cc +++ b/NPSimulation/src/Plastic.cc @@ -13,7 +13,7 @@ *---------------------------------------------------------------------------* * Decription: * * This class describe a Modular cylindrical Plastic Scintillator * - * Few Material are instantiate and user can choose position and dimension * + * Few Material are instantiate and user can choose position and dimension * * but also the adding of a lead plate on the rear side of the detector * * * *---------------------------------------------------------------------------* @@ -58,8 +58,8 @@ using namespace CLHEP; namespace PLASTIC { // Energy and time Resolution - const G4double ResoTime = 4.2 ;// = 10ns of Resolution // Unit is MeV/2.35 - const G4double ResoEnergy = 5.0 ;// Resolution in % + const G4double ResoTime = 4.2 ;// = 10ns of Resolution // Unit is MeV/2.35 + const G4double ResoEnergy = 5.0 ;// Resolution in % } @@ -70,61 +70,61 @@ using namespace PLASTIC ; // Plastic Specific Method Plastic::Plastic() { - InitializeMaterial(); - m_Event = new TPlasticData() ; + InitializeMaterial(); + m_Event = new TPlasticData() ; } Plastic::~Plastic() { - delete m_MaterialPlastic_BC400 ; - delete m_MaterialPlastic_BC452_2 ; - delete m_MaterialPlastic_BC452_5 ; - delete m_MaterialPlastic_BC452_10 ; - delete m_MaterialLead ; - delete m_PlasticScorer ; + delete m_MaterialPlastic_BC400 ; + delete m_MaterialPlastic_BC452_2 ; + delete m_MaterialPlastic_BC452_5 ; + delete m_MaterialPlastic_BC452_10 ; + delete m_MaterialLead ; + delete m_PlasticScorer ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Plastic::AddPlastic( G4double R , - G4double Theta , - G4double Phi , - G4double PlasticThickness , - G4double PlasticRadius , - G4String Scintillator , - G4double LeadThickness ) - { - - m_R.push_back(R) ; - m_Theta.push_back(Theta) ; - m_Phi.push_back(Phi) ; - m_PlasticThickness.push_back(PlasticThickness) ; - m_LeadThickness.push_back(LeadThickness) ; - m_Scintillator.push_back(Scintillator) ; - m_PlasticRadius.push_back(PlasticRadius) ; // cylindrical shape - m_PlasticHeight.push_back(-1) ; // squared shape - m_PlasticWidth.push_back(-1) ; // squared shape - } - -void Plastic::AddPlastic( G4double R , - G4double Theta , - G4double Phi , - G4double Height , - G4double Width , - G4double PlasticThickness , - G4String Scintillator , - G4double LeadThickness ) - { - m_R.push_back(R) ; - m_Theta.push_back(Theta) ; - m_Phi.push_back(Phi) ; - m_PlasticThickness.push_back(PlasticThickness) ; - m_LeadThickness.push_back(LeadThickness) ; - m_Scintillator.push_back(Scintillator) ; - m_PlasticRadius.push_back(-1) ; // cylindrical shape - m_PlasticHeight.push_back(Height) ; // squared shape - m_PlasticWidth.push_back(Width) ; // squared shape - - } +void Plastic::AddPlastic( G4double R , + G4double Theta , + G4double Phi , + G4double PlasticThickness , + G4double PlasticRadius , + G4String Scintillator , + G4double LeadThickness ) + { + + m_R.push_back(R) ; + m_Theta.push_back(Theta) ; + m_Phi.push_back(Phi) ; + m_PlasticThickness.push_back(PlasticThickness) ; + m_LeadThickness.push_back(LeadThickness) ; + m_Scintillator.push_back(Scintillator) ; + m_PlasticRadius.push_back(PlasticRadius) ; // cylindrical shape + m_PlasticHeight.push_back(-1) ; // squared shape + m_PlasticWidth.push_back(-1) ; // squared shape + } + +void Plastic::AddPlastic( G4double R , + G4double Theta , + G4double Phi , + G4double Height , + G4double Width , + G4double PlasticThickness , + G4String Scintillator , + G4double LeadThickness ) + { + m_R.push_back(R) ; + m_Theta.push_back(Theta) ; + m_Phi.push_back(Phi) ; + m_PlasticThickness.push_back(PlasticThickness) ; + m_LeadThickness.push_back(LeadThickness) ; + m_Scintillator.push_back(Scintillator) ; + m_PlasticRadius.push_back(-1) ; // cylindrical shape + m_PlasticHeight.push_back(Height) ; // squared shape + m_PlasticWidth.push_back(Width) ; // squared shape + + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -137,234 +137,234 @@ void Plastic::AddPlastic( G4double R , // Called in DetecorConstruction::ReadDetextorConfiguration Method void Plastic::ReadConfiguration(string Path) { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; - - G4double Theta = 0 , Phi = 0 , R = 0 , Thickness = 0 , Radius = 0 , LeadThickness = 0, X = 0 , Y = 0 , Z = 0 , Width = 0 , Height = 0 ; - G4String Scintillator, Shape ; - - bool check_Theta = false ; - bool check_Phi = false ; - bool check_R = false ; - bool check_Thickness = false ; - bool check_Radius = false ; - bool check_LeadThickness = false ; - bool check_Scintillator = false ; - bool check_Height = false ; - bool check_Width = false ; - bool check_Shape = false ; - bool check_X = false ; - bool check_Y = false ; - bool check_Z = false ; - bool ReadingStatus = false ; + ifstream ConfigFile ; + ConfigFile.open(Path.c_str()) ; + string LineBuffer ; + string DataBuffer ; + + G4double Theta = 0 , Phi = 0 , R = 0 , Thickness = 0 , Radius = 0 , LeadThickness = 0, X = 0 , Y = 0 , Z = 0 , Width = 0 , Height = 0 ; + G4String Scintillator, Shape ; + + bool check_Theta = false ; + bool check_Phi = false ; + bool check_R = false ; + bool check_Thickness = false ; + bool check_Radius = false ; + bool check_LeadThickness = false ; + bool check_Scintillator = false ; + bool check_Height = false ; + bool check_Width = false ; + bool check_Shape = false ; + bool check_X = false ; + bool check_Y = false ; + bool check_Z = false ; + bool ReadingStatus = false ; while (!ConfigFile.eof()) - { + { - getline(ConfigFile, LineBuffer); - - // If line is a Start Up Plastic bloc, Reading toggle to true - if (LineBuffer.compare(0, 7, "Plastic") == 0) - { - G4cout << "///" << G4endl ; - G4cout << "Platic found: " << G4endl ; - ReadingStatus = true ; - - } - - // Else don't toggle to Reading Block Status - else ReadingStatus = false ; - - // Reading Block - while(ReadingStatus) - { - // Pickup Next Word - ConfigFile >> DataBuffer ; - - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - // Finding another telescope (safety), toggle out - else if (DataBuffer.compare(0, 6, "Plastic") == 0) { - cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; - ReadingStatus = false ; - } - - //Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta * deg; - cout << "Theta: " << Theta / deg << endl; - } - - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi * deg; - cout << "Phi: " << Phi / deg << endl; - } - - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R * mm; - cout << "R: " << R/mm << endl; - } - - //Position method - else if (DataBuffer.compare(0, 2, "X=") == 0) { - check_X = true; - ConfigFile >> DataBuffer ; - X = atof(DataBuffer.c_str()) ; - X = X * mm; - cout << "X: " << X / mm << endl; - } - - else if (DataBuffer.compare(0, 2, "Y=") == 0) { - check_Y = true; - ConfigFile >> DataBuffer ; - Y = atof(DataBuffer.c_str()) ; - Y = Y * mm; - cout << "Y: " << Y / mm << endl; - } - - else if (DataBuffer.compare(0, 2, "Z=") == 0) { - check_Z = true; - ConfigFile >> DataBuffer ; - Z = atof(DataBuffer.c_str()) ; - Z = Z * mm; - cout << "Z: " << Z / mm << endl; - } - - - //General - else if (DataBuffer.compare(0, 6, "Shape=") == 0) { - check_Shape = true; - ConfigFile >> DataBuffer ; - Shape = DataBuffer ; - cout << "Shape: " << Shape << endl; - } - - // Cylindrical shape - else if (DataBuffer.compare(0, 7, "Radius=") == 0) { - check_Radius = true; - ConfigFile >> DataBuffer ; - Radius = atof(DataBuffer.c_str()) ; - Radius = Radius * mm; - cout << "Plastic Radius: " << Radius/mm << endl; - } - - // Squared shape - else if (DataBuffer.compare(0, 7, "Width=") == 0) { - check_Width = true; - ConfigFile >> DataBuffer ; - Width = atof(DataBuffer.c_str()) ; - Width = Width * mm; - cout << "Plastic Width: " << Width/mm << endl; - } - - else if (DataBuffer.compare(0, 7, "Height=") == 0) { - check_Height = true; - ConfigFile >> DataBuffer ; - Height = atof(DataBuffer.c_str()) ; - Height = Height * mm; - cout << "Plastic Height: " << Height/mm << endl; - } - - // Common - else if (DataBuffer.compare(0, 10, "Thickness=") == 0) { - check_Thickness = true; - ConfigFile >> DataBuffer ; - Thickness = atof(DataBuffer.c_str()) ; - Thickness = Thickness * mm; - cout << "Plastic Thickness: " << Thickness/mm << endl; - } - - else if (DataBuffer.compare(0, 13, "Scintillator=") == 0) { - check_Scintillator = true ; - ConfigFile >> DataBuffer ; - Scintillator = DataBuffer ; - cout << "Plastic Scintillator type: " << Scintillator << endl; - } - - else if (DataBuffer.compare(0, 14, "LeadThickness=") == 0) { - check_LeadThickness = true; - ConfigFile >> DataBuffer ; - LeadThickness = atof(DataBuffer.c_str()) ; - LeadThickness = LeadThickness * mm; - cout << "Lead Thickness : " << LeadThickness/mm << endl; - } - - /////////////////////////////////////////////////// - // If no Detector Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} - - ///////////////////////////////////////////////// - // If All necessary information there, toggle out - - if ( ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius && check_LeadThickness && check_Scintillator && check_Shape) // Cylindrical case - || ( check_X && check_Y && check_Z && check_Thickness && check_Radius && check_LeadThickness && check_Scintillator ) - - || ( check_Theta && check_Phi && check_R && check_Thickness && check_Width && check_Height && check_LeadThickness && check_Scintillator && check_Shape ) // Squared case - || ( check_X && check_Y && check_Z && check_Thickness && check_Width && check_Height && check_LeadThickness && check_Scintillator ) - ) - { - - if (check_X && check_Y && check_Z) - { - R = sqrt (X*X+Y*Y+Z*Z) ; - Theta = acos(Z / (R) ) ; - Phi = atan2(Y,X) ; - } - - if (Shape == "Cylinder") - AddPlastic( R , - Theta , - Phi , - Thickness , - Radius , - Scintillator , - LeadThickness ); - - else if (Shape == "Square") - AddPlastic( R , - Theta , - Phi , - Height , - Width , - Thickness , - Scintillator , - LeadThickness ); - - // Reinitialisation of Check Boolean - - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_Thickness = false ; - check_Radius = false ; - check_LeadThickness = false ; - check_Scintillator = false ; - check_Height = false ; - check_Width = false ; - check_Shape = false ; - check_X = false ; - check_Y = false ; - check_Z = false ; - ReadingStatus = false ; - cout << "///"<< endl ; - } - - } - } + getline(ConfigFile, LineBuffer); + + // If line is a Start Up Plastic bloc, Reading toggle to true + if (LineBuffer.compare(0, 7, "Plastic") == 0) + { + G4cout << "///" << G4endl ; + G4cout << "Platic found: " << G4endl ; + ReadingStatus = true ; + + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; + + // Reading Block + while(ReadingStatus) + { + // Pickup Next Word + ConfigFile >> DataBuffer ; + + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 6, "Plastic") == 0) { + cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; + ReadingStatus = false ; + } + + //Angle method + else if (DataBuffer.compare(0, 6, "THETA=") == 0) { + check_Theta = true; + ConfigFile >> DataBuffer ; + Theta = atof(DataBuffer.c_str()) ; + Theta = Theta * deg; + cout << "Theta: " << Theta / deg << endl; + } + + else if (DataBuffer.compare(0, 4, "PHI=") == 0) { + check_Phi = true; + ConfigFile >> DataBuffer ; + Phi = atof(DataBuffer.c_str()) ; + Phi = Phi * deg; + cout << "Phi: " << Phi / deg << endl; + } + + else if (DataBuffer.compare(0, 2, "R=") == 0) { + check_R = true; + ConfigFile >> DataBuffer ; + R = atof(DataBuffer.c_str()) ; + R = R * mm; + cout << "R: " << R/mm << endl; + } + + //Position method + else if (DataBuffer.compare(0, 2, "X=") == 0) { + check_X = true; + ConfigFile >> DataBuffer ; + X = atof(DataBuffer.c_str()) ; + X = X * mm; + cout << "X: " << X / mm << endl; + } + + else if (DataBuffer.compare(0, 2, "Y=") == 0) { + check_Y = true; + ConfigFile >> DataBuffer ; + Y = atof(DataBuffer.c_str()) ; + Y = Y * mm; + cout << "Y: " << Y / mm << endl; + } + + else if (DataBuffer.compare(0, 2, "Z=") == 0) { + check_Z = true; + ConfigFile >> DataBuffer ; + Z = atof(DataBuffer.c_str()) ; + Z = Z * mm; + cout << "Z: " << Z / mm << endl; + } + + + //General + else if (DataBuffer.compare(0, 6, "Shape=") == 0) { + check_Shape = true; + ConfigFile >> DataBuffer ; + Shape = DataBuffer ; + cout << "Shape: " << Shape << endl; + } + + // Cylindrical shape + else if (DataBuffer.compare(0, 7, "Radius=") == 0) { + check_Radius = true; + ConfigFile >> DataBuffer ; + Radius = atof(DataBuffer.c_str()) ; + Radius = Radius * mm; + cout << "Plastic Radius: " << Radius/mm << endl; + } + + // Squared shape + else if (DataBuffer.compare(0, 7, "Width=") == 0) { + check_Width = true; + ConfigFile >> DataBuffer ; + Width = atof(DataBuffer.c_str()) ; + Width = Width * mm; + cout << "Plastic Width: " << Width/mm << endl; + } + + else if (DataBuffer.compare(0, 7, "Height=") == 0) { + check_Height = true; + ConfigFile >> DataBuffer ; + Height = atof(DataBuffer.c_str()) ; + Height = Height * mm; + cout << "Plastic Height: " << Height/mm << endl; + } + + // Common + else if (DataBuffer.compare(0, 10, "Thickness=") == 0) { + check_Thickness = true; + ConfigFile >> DataBuffer ; + Thickness = atof(DataBuffer.c_str()) ; + Thickness = Thickness * mm; + cout << "Plastic Thickness: " << Thickness/mm << endl; + } + + else if (DataBuffer.compare(0, 13, "Scintillator=") == 0) { + check_Scintillator = true ; + ConfigFile >> DataBuffer ; + Scintillator = DataBuffer ; + cout << "Plastic Scintillator type: " << Scintillator << endl; + } + + else if (DataBuffer.compare(0, 14, "LeadThickness=") == 0) { + check_LeadThickness = true; + ConfigFile >> DataBuffer ; + LeadThickness = atof(DataBuffer.c_str()) ; + LeadThickness = LeadThickness * mm; + cout << "Lead Thickness : " << LeadThickness/mm << endl; + } + + /////////////////////////////////////////////////// + // If no Detector Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + + if ( ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius && check_LeadThickness && check_Scintillator && check_Shape) // Cylindrical case + || ( check_X && check_Y && check_Z && check_Thickness && check_Radius && check_LeadThickness && check_Scintillator ) + + || ( check_Theta && check_Phi && check_R && check_Thickness && check_Width && check_Height && check_LeadThickness && check_Scintillator && check_Shape ) // Squared case + || ( check_X && check_Y && check_Z && check_Thickness && check_Width && check_Height && check_LeadThickness && check_Scintillator ) + ) + { + + if (check_X && check_Y && check_Z) + { + R = sqrt (X*X+Y*Y+Z*Z) ; + Theta = acos(Z / (R) ) ; + Phi = atan2(Y,X) ; + } + + if (Shape == "Cylinder") + AddPlastic( R , + Theta , + Phi , + Thickness , + Radius , + Scintillator , + LeadThickness ); + + else if (Shape == "Square") + AddPlastic( R , + Theta , + Phi , + Height , + Width , + Thickness , + Scintillator , + LeadThickness ); + + // Reinitialisation of Check Boolean + + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_Thickness = false ; + check_Radius = false ; + check_LeadThickness = false ; + check_Scintillator = false ; + check_Height = false ; + check_Width = false ; + check_Shape = false ; + check_X = false ; + check_Y = false ; + check_Z = false ; + ReadingStatus = false ; + cout << "///"<< endl ; + } + + } + } } @@ -372,149 +372,149 @@ void Plastic::ReadConfiguration(string Path) // Called After DetecorConstruction::AddDetector Method void Plastic::ConstructDetector(G4LogicalVolume* world) { - G4ThreeVector Det_pos = G4ThreeVector(0, 0, 0) ; - + G4ThreeVector Det_pos = G4ThreeVector(0, 0, 0) ; + for (unsigned short i = 0 ; i < m_R.size() ; i++) - { + { G4double wX = m_R[i] * sin(m_Theta[i] ) * cos(m_Phi[i] ) ; G4double wY = m_R[i] * sin(m_Theta[i] ) * sin(m_Phi[i] ) ; - G4double wZ = m_R[i] * cos(m_Theta[i] ) ; + G4double wZ = m_R[i] * cos(m_Theta[i] ) ; Det_pos = G4ThreeVector(wX, wY, wZ) ; // G4LogicalVolume* logicPlastic = NULL ; - - VolumeMaker(Det_pos , i+1, world) ; + + VolumeMaker(Det_pos , i+1, world) ; } } void Plastic::VolumeMaker(G4ThreeVector Det_pos, int DetNumber, G4LogicalVolume* world) - { - //////////////////////////////////////////////////////////////// - ////////////// Starting Volume Definition ////////////////////// - //////////////////////////////////////////////////////////////// - G4PVPlacement* PVPBuffer ; - - // Name of the module - std::ostringstream DetectorNumber ; - DetectorNumber << DetNumber ; - G4String Name = "Plastic" + DetectorNumber.str() ; - - int i = DetNumber-1; - - G4Material* PlasticMaterial ; - - if(m_Scintillator[i] == "BC400" ) PlasticMaterial = m_MaterialPlastic_BC400 ; - else if(m_Scintillator[i] == "BC452_2" ) PlasticMaterial = m_MaterialPlastic_BC452_2 ; - else if(m_Scintillator[i] == "BC452_5" ) PlasticMaterial = m_MaterialPlastic_BC452_5 ; - else if(m_Scintillator[i] == "BC452_10" ) PlasticMaterial = m_MaterialPlastic_BC452_10 ; - else { - G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; - G4cout << "WARNING: Material Not found, default material set : BC400" << endl ; - G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; - PlasticMaterial = m_MaterialPlastic_BC400; - } - - - // Definition of the volume containing the sensitive detector - - - // Cylindrical Case - if(m_PlasticRadius[i]!=-1) - { - if(m_PlasticThickness[i]>0 && m_PlasticRadius[i]>0) - { - G4Tubs* solidPlastic = new G4Tubs( Name , - 0 , - m_PlasticRadius[i] , - m_PlasticThickness[i]/2 , - 0*deg , - 360*deg ); - - G4LogicalVolume* logicPlastic = new G4LogicalVolume(solidPlastic, PlasticMaterial, Name+ "_Scintillator", 0, 0, 0); - logicPlastic->SetSensitiveDetector(m_PlasticScorer); - - G4VisAttributes* PlastVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; - logicPlastic->SetVisAttributes(PlastVisAtt) ; - - - - PVPBuffer = new G4PVPlacement( 0 , - Det_pos , - logicPlastic , - Name + "_Scintillator" , - world , - false , - 0 ); - } - - - if(m_LeadThickness[i]>0&& m_PlasticRadius[i]>0) - { - G4Tubs* solidLead = new G4Tubs( Name+"_Lead" , - 0 , - m_PlasticRadius[i] , - m_LeadThickness[i]/2 , - 0*deg , - 360*deg ); - - G4LogicalVolume* logicLead = new G4LogicalVolume(solidLead, m_MaterialLead, Name+"_Lead", 0, 0, 0); - G4VisAttributes* LeadVisAtt = new G4VisAttributes(G4Colour(0.1, 0.1, 0.1)) ; - logicLead->SetVisAttributes(LeadVisAtt) ; - - PVPBuffer = new G4PVPlacement( 0 , - Det_pos+(m_PlasticThickness[i]/2+m_LeadThickness[i]/2)*Det_pos.unit() , - logicLead , - Name+"_Lead" , - world , - false , - 0 ); - - } - } - - // Squared case - if(m_PlasticHeight[i]!=-1) - { - - if(m_PlasticThickness[i]>0 && m_PlasticHeight[i]>0 && m_PlasticWidth[i]>0) - { - G4Box* solidPlastic = new G4Box(Name, 0.5*m_PlasticWidth[i], 0.5*m_PlasticHeight[i], 0.5*m_PlasticThickness[i]); - G4LogicalVolume* logicPlastic = new G4LogicalVolume(solidPlastic, PlasticMaterial, Name+ "_Scintillator", 0, 0, 0); - logicPlastic->SetSensitiveDetector(m_PlasticScorer); - - G4VisAttributes* PlastVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; - logicPlastic->SetVisAttributes(PlastVisAtt) ; - - PVPBuffer = new G4PVPlacement( 0 , - Det_pos , - logicPlastic , - Name + "_Scintillator" , - world , - false , - 0 ); - } - - if(m_LeadThickness[i]>0&& m_PlasticHeight[i]>0 && m_PlasticWidth[i]>0) - { - G4Box* solidLead = new G4Box(Name+"_Lead", 0.5*m_PlasticWidth[i], 0.5*m_PlasticHeight[i], 0.5*m_LeadThickness[i]); - - G4LogicalVolume* logicLead = new G4LogicalVolume(solidLead, m_MaterialLead, Name+"_Lead", 0, 0, 0); - G4VisAttributes* LeadVisAtt = new G4VisAttributes(G4Colour(0.1, 0.1, 0.1)) ; - logicLead->SetVisAttributes(LeadVisAtt) ; - - PVPBuffer = new G4PVPlacement( 0 , - Det_pos+(m_PlasticThickness[i]/2+m_LeadThickness[i]/2)*Det_pos.unit() , - logicLead , - Name+"_Lead" , - world , - false , - 0 ); - - } - } - - } + { + //////////////////////////////////////////////////////////////// + ////////////// Starting Volume Definition ////////////////////// + //////////////////////////////////////////////////////////////// + G4PVPlacement* PVPBuffer ; + + // Name of the module + std::ostringstream DetectorNumber ; + DetectorNumber << DetNumber ; + G4String Name = "Plastic" + DetectorNumber.str() ; + + int i = DetNumber-1; + + G4Material* PlasticMaterial ; + + if(m_Scintillator[i] == "BC400" ) PlasticMaterial = m_MaterialPlastic_BC400 ; + else if(m_Scintillator[i] == "BC452_2" ) PlasticMaterial = m_MaterialPlastic_BC452_2 ; + else if(m_Scintillator[i] == "BC452_5" ) PlasticMaterial = m_MaterialPlastic_BC452_5 ; + else if(m_Scintillator[i] == "BC452_10" ) PlasticMaterial = m_MaterialPlastic_BC452_10 ; + else { + G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; + G4cout << "WARNING: Material Not found, default material set : BC400" << endl ; + G4cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl ; + PlasticMaterial = m_MaterialPlastic_BC400; + } + + + // Definition of the volume containing the sensitive detector + + + // Cylindrical Case + if(m_PlasticRadius[i]!=-1) + { + if(m_PlasticThickness[i]>0 && m_PlasticRadius[i]>0) + { + G4Tubs* solidPlastic = new G4Tubs( Name , + 0 , + m_PlasticRadius[i] , + m_PlasticThickness[i]/2 , + 0*deg , + 360*deg ); + + G4LogicalVolume* logicPlastic = new G4LogicalVolume(solidPlastic, PlasticMaterial, Name+ "_Scintillator", 0, 0, 0); + logicPlastic->SetSensitiveDetector(m_PlasticScorer); + + G4VisAttributes* PlastVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; + logicPlastic->SetVisAttributes(PlastVisAtt) ; + + + + PVPBuffer = new G4PVPlacement( 0 , + Det_pos , + logicPlastic , + Name + "_Scintillator" , + world , + false , + 0 ); + } + + + if(m_LeadThickness[i]>0&& m_PlasticRadius[i]>0) + { + G4Tubs* solidLead = new G4Tubs( Name+"_Lead" , + 0 , + m_PlasticRadius[i] , + m_LeadThickness[i]/2 , + 0*deg , + 360*deg ); + + G4LogicalVolume* logicLead = new G4LogicalVolume(solidLead, m_MaterialLead, Name+"_Lead", 0, 0, 0); + G4VisAttributes* LeadVisAtt = new G4VisAttributes(G4Colour(0.1, 0.1, 0.1)) ; + logicLead->SetVisAttributes(LeadVisAtt) ; + + PVPBuffer = new G4PVPlacement( 0 , + Det_pos+(m_PlasticThickness[i]/2+m_LeadThickness[i]/2)*Det_pos.unit() , + logicLead , + Name+"_Lead" , + world , + false , + 0 ); + + } + } + + // Squared case + if(m_PlasticHeight[i]!=-1) + { + + if(m_PlasticThickness[i]>0 && m_PlasticHeight[i]>0 && m_PlasticWidth[i]>0) + { + G4Box* solidPlastic = new G4Box(Name, 0.5*m_PlasticWidth[i], 0.5*m_PlasticHeight[i], 0.5*m_PlasticThickness[i]); + G4LogicalVolume* logicPlastic = new G4LogicalVolume(solidPlastic, PlasticMaterial, Name+ "_Scintillator", 0, 0, 0); + logicPlastic->SetSensitiveDetector(m_PlasticScorer); + + G4VisAttributes* PlastVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)) ; + logicPlastic->SetVisAttributes(PlastVisAtt) ; + + PVPBuffer = new G4PVPlacement( 0 , + Det_pos , + logicPlastic , + Name + "_Scintillator" , + world , + false , + 0 ); + } + + if(m_LeadThickness[i]>0&& m_PlasticHeight[i]>0 && m_PlasticWidth[i]>0) + { + G4Box* solidLead = new G4Box(Name+"_Lead", 0.5*m_PlasticWidth[i], 0.5*m_PlasticHeight[i], 0.5*m_LeadThickness[i]); + + G4LogicalVolume* logicLead = new G4LogicalVolume(solidLead, m_MaterialLead, Name+"_Lead", 0, 0, 0); + G4VisAttributes* LeadVisAtt = new G4VisAttributes(G4Colour(0.1, 0.1, 0.1)) ; + logicLead->SetVisAttributes(LeadVisAtt) ; + + PVPBuffer = new G4PVPlacement( 0 , + Det_pos+(m_PlasticThickness[i]/2+m_LeadThickness[i]/2)*Det_pos.unit() , + logicLead , + Name+"_Lead" , + world , + false , + 0 ); + + } + } + + } // Add Detector branch to the EventTree. // Called After DetecorConstruction::AddDetector Method @@ -529,44 +529,44 @@ void Plastic::InitializeRootOutput() // Called at in the EventAction::EndOfEventAvtion void Plastic::ReadSensitive(const G4Event* event) { - G4String DetectorNumber ; - m_Event->Clear() ; + G4String DetectorNumber ; + m_Event->Clear() ; ////////////////////////////////////////////////////////////////////////////////////// //////////////////////// Used to Read Event Map of detector ////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - std::map<G4int, G4int*>::iterator DetectorNumber_itr ; - std::map<G4int, G4double*>::iterator Energy_itr ; - std::map<G4int, G4double*>::iterator Time_itr ; - - G4THitsMap<G4int>* DetectorNumberHitMap ; - G4THitsMap<G4double>* EnergyHitMap ; - G4THitsMap<G4double>* TimeHitMap ; - + std::map<G4int, G4int*>::iterator DetectorNumber_itr ; + std::map<G4int, G4double*>::iterator Energy_itr ; + std::map<G4int, G4double*>::iterator Time_itr ; + + G4THitsMap<G4int>* DetectorNumberHitMap ; + G4THitsMap<G4double>* EnergyHitMap ; + G4THitsMap<G4double>* TimeHitMap ; + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// // Read the Scorer associate to the Silicon Strip - //Detector Number - G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("PlasticScorer/PlasticNumber") ; - DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; - DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; + //Detector Number + G4int StripDetCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("PlasticScorer/PlasticNumber") ; + DetectorNumberHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripDetCollectionID)) ; + DetectorNumber_itr = DetectorNumberHitMap->GetMap()->begin() ; - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("PlasticScorer/Energy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - Energy_itr = EnergyHitMap->GetMap()->begin() ; + //Energy + G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("PlasticScorer/Energy") ; + EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; + Energy_itr = EnergyHitMap->GetMap()->begin() ; - //Time of Flight - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("PlasticScorer/Time") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - Time_itr = TimeHitMap->GetMap()->begin() ; + //Time of Flight + G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("PlasticScorer/Time") ; + TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; + Time_itr = TimeHitMap->GetMap()->begin() ; - G4int sizeN = DetectorNumberHitMap->entries() ; - G4int sizeE = EnergyHitMap->entries() ; - G4int sizeT = TimeHitMap->entries() ; + G4int sizeN = DetectorNumberHitMap->entries() ; + G4int sizeE = EnergyHitMap->entries() ; + G4int sizeT = TimeHitMap->entries() ; // Loop on Plastic Number for (G4int l = 0 ; l < sizeN ; l++) { @@ -576,34 +576,34 @@ void Plastic::ReadSensitive(const G4Event* event) if (N > 0) { - m_Event->SetPlasticNumber(N) ; - - // Energy - Energy_itr = EnergyHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeE ; h++) { - G4int ETrackID = Energy_itr->first - N ; - G4double E = *(Energy_itr->second) ; - - if (ETrackID == NTrackID) { - m_Event->SetEnergy(RandGauss::shoot(E, E*ResoEnergy/100./2.35)) ; - } - - Energy_itr++; - } - - - // Time - Time_itr = TimeHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N ; - G4double T = *(Time_itr->second) ; - - if (TTrackID == NTrackID) { - m_Event->SetTime(RandGauss::shoot(T, ResoTime)) ; - } - - Time_itr++; - } + m_Event->SetPlasticNumber(N) ; + + // Energy + Energy_itr = EnergyHitMap->GetMap()->begin(); + for (G4int h = 0 ; h < sizeE ; h++) { + G4int ETrackID = Energy_itr->first - N ; + G4double E = *(Energy_itr->second) ; + + if (ETrackID == NTrackID) { + m_Event->SetEnergy(RandGauss::shoot(E, E*ResoEnergy/100./2.35)) ; + } + + Energy_itr++; + } + + + // Time + Time_itr = TimeHitMap->GetMap()->begin(); + for (G4int h = 0 ; h < sizeT ; h++) { + G4int TTrackID = Time_itr->first - N ; + G4double T = *(Time_itr->second) ; + + if (TTrackID == NTrackID) { + m_Event->SetTime(RandGauss::shoot(T, ResoTime)) ; + } + + Time_itr++; + } } @@ -611,81 +611,81 @@ void Plastic::ReadSensitive(const G4Event* event) } // clear map for next event - TimeHitMap ->clear() ; - DetectorNumberHitMap ->clear() ; - EnergyHitMap ->clear() ; + TimeHitMap ->clear() ; + DetectorNumberHitMap ->clear() ; + EnergyHitMap ->clear() ; } //////////////////////////////////////////////////////////////// void Plastic::InitializeMaterial() - { - - //////////////////////////////////////////////////////////////// - /////////////////Element Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - G4String symbol ; - G4double density = 0. , a = 0, z = 0 ; - G4int ncomponents = 0, natoms = 0, fractionmass = 0 ; - - // for Plastic - G4Element* H = new G4Element("Hydrogen" , symbol = "H" , z = 1 , a = 1.01 * g / mole); - G4Element* C = new G4Element("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); - G4Element* Pb = new G4Element("Lead" , symbol = "Pb" , z = 82 , a = 207.2 * g / mole); - //////////////////////////////////////////////////////////////// - /////////////////Material Definition /////////////////////////// - //////////////////////////////////////////////////////////////// - - // Pb - a = 207.2 * g / mole; - density = 11.34 * g / cm3; - m_MaterialLead = new G4Material("Lead", z = 82 , a, density); - - - // Plastic BC-400 - density = 1.032 * g / cm3; - m_MaterialPlastic_BC400 = new G4Material("Plastic_BC400", density, ncomponents = 2); - m_MaterialPlastic_BC400->AddElement(H , natoms = 10); - m_MaterialPlastic_BC400->AddElement(C , natoms = 9); - - // Plastic BC-452 Pb 2% - density = 1.05 * g / cm3; - m_MaterialPlastic_BC452_2 = new G4Material("Plastic_BC452_2", density, ncomponents = 3); - m_MaterialPlastic_BC452_2->AddElement(H , natoms = 10); - m_MaterialPlastic_BC452_2->AddElement(C , natoms = 9); - m_MaterialPlastic_BC452_2->AddElement(Pb , fractionmass=2*perCent); - - // Plastic BC-452 Pb 5% - density = 1.08 * g / cm3; - m_MaterialPlastic_BC452_5 = new G4Material("Plastic_BC452_5", density, ncomponents = 3); - m_MaterialPlastic_BC452_5->AddElement(H , natoms = 10); - m_MaterialPlastic_BC452_5->AddElement(C , natoms = 9); - m_MaterialPlastic_BC452_5->AddElement(Pb , fractionmass=5*perCent); - - // Plastic BC-452 Pb 10% - density = 1.17 * g / cm3; - m_MaterialPlastic_BC452_10 = new G4Material("Plastic_BC452_10", density, ncomponents = 3); - m_MaterialPlastic_BC452_10->AddElement(H , natoms = 10); - m_MaterialPlastic_BC452_10->AddElement(C , natoms = 9); - m_MaterialPlastic_BC452_10->AddElement(Pb , fractionmass=10*perCent); - - } - -//////////////////////////////////////////////////////////////// + { + + //////////////////////////////////////////////////////////////// + /////////////////Element Definition /////////////////////////// + //////////////////////////////////////////////////////////////// + G4String symbol ; + G4double density = 0. , a = 0, z = 0 ; + G4int ncomponents = 0, natoms = 0, fractionmass = 0 ; + + // for Plastic + G4Element* H = new G4Element("Hydrogen" , symbol = "H" , z = 1 , a = 1.01 * g / mole); + G4Element* C = new G4Element("Carbon" , symbol = "C" , z = 6 , a = 12.011 * g / mole); + G4Element* Pb = new G4Element("Lead" , symbol = "Pb" , z = 82 , a = 207.2 * g / mole); + //////////////////////////////////////////////////////////////// + /////////////////Material Definition /////////////////////////// + //////////////////////////////////////////////////////////////// + + // Pb + a = 207.2 * g / mole; + density = 11.34 * g / cm3; + m_MaterialLead = new G4Material("Lead", z = 82 , a, density); + + + // Plastic BC-400 + density = 1.032 * g / cm3; + m_MaterialPlastic_BC400 = new G4Material("Plastic_BC400", density, ncomponents = 2); + m_MaterialPlastic_BC400->AddElement(H , natoms = 10); + m_MaterialPlastic_BC400->AddElement(C , natoms = 9); + + // Plastic BC-452 Pb 2% + density = 1.05 * g / cm3; + m_MaterialPlastic_BC452_2 = new G4Material("Plastic_BC452_2", density, ncomponents = 3); + m_MaterialPlastic_BC452_2->AddElement(H , natoms = 10); + m_MaterialPlastic_BC452_2->AddElement(C , natoms = 9); + m_MaterialPlastic_BC452_2->AddElement(Pb , fractionmass=2*perCent); + + // Plastic BC-452 Pb 5% + density = 1.08 * g / cm3; + m_MaterialPlastic_BC452_5 = new G4Material("Plastic_BC452_5", density, ncomponents = 3); + m_MaterialPlastic_BC452_5->AddElement(H , natoms = 10); + m_MaterialPlastic_BC452_5->AddElement(C , natoms = 9); + m_MaterialPlastic_BC452_5->AddElement(Pb , fractionmass=5*perCent); + + // Plastic BC-452 Pb 10% + density = 1.17 * g / cm3; + m_MaterialPlastic_BC452_10 = new G4Material("Plastic_BC452_10", density, ncomponents = 3); + m_MaterialPlastic_BC452_10->AddElement(H , natoms = 10); + m_MaterialPlastic_BC452_10->AddElement(C , natoms = 9); + m_MaterialPlastic_BC452_10->AddElement(Pb , fractionmass=10*perCent); + + } + +//////////////////////////////////////////////////////////////// void Plastic::InitializeScorers() - { - m_PlasticScorer = new G4MultiFunctionalDetector("PlasticScorer") ; - G4SDManager::GetSDMpointer()->AddNewDetector(m_PlasticScorer); - - G4VPrimitiveScorer* DetNbr = new PSDetectorNumber("PlasticNumber","Plastic", 0) ; - G4VPrimitiveScorer* Energy = new PSEnergy("Energy","Plastic", 0) ; - G4VPrimitiveScorer* Time = new PSTOF("Time","Plastic", 0) ; - - //and register it to the multifunctionnal detector - m_PlasticScorer->RegisterPrimitive(DetNbr) ; - m_PlasticScorer->RegisterPrimitive(Energy) ; - m_PlasticScorer->RegisterPrimitive(Time) ; - - - } + { + m_PlasticScorer = new G4MultiFunctionalDetector("PlasticScorer") ; + G4SDManager::GetSDMpointer()->AddNewDetector(m_PlasticScorer); + + G4VPrimitiveScorer* DetNbr = new PSDetectorNumber("PlasticNumber","Plastic", 0) ; + G4VPrimitiveScorer* Energy = new PSEnergy("Energy","Plastic", 0) ; + G4VPrimitiveScorer* Time = new PSTOF("Time","Plastic", 0) ; + + //and register it to the multifunctionnal detector + m_PlasticScorer->RegisterPrimitive(DetNbr) ; + m_PlasticScorer->RegisterPrimitive(Energy) ; + m_PlasticScorer->RegisterPrimitive(Time) ; + + + } //////////////////////////////////////////////////////////////// diff --git a/NPSimulation/src/PrimaryGeneratorAction.cc b/NPSimulation/src/PrimaryGeneratorAction.cc index 458bb015f..50f0ae0df 100644 --- a/NPSimulation/src/PrimaryGeneratorAction.cc +++ b/NPSimulation/src/PrimaryGeneratorAction.cc @@ -107,25 +107,25 @@ void PrimaryGeneratorAction::ReadEventGeneratorFile(string Path) //Search for Isotropic source else if (LineBuffer.compare(0, 9, "Isotropic") == 0 && !check_Isotropic) { - check_Isotropic = true ; - VEventGenerator* myEventGenerator = new EventGeneratorIsotropic() ; - EventGeneratorFile.close() ; - myEventGenerator->ReadConfiguration(Path) ; - EventGeneratorFile.open(Path.c_str()) ; - myEventGenerator->InitializeRootOutput() ; - m_EventGenerator = myEventGenerator ; + check_Isotropic = true; + VEventGenerator* myEventGenerator = new EventGeneratorIsotropic(); + EventGeneratorFile.close(); + myEventGenerator->ReadConfiguration(Path); + EventGeneratorFile.open(Path.c_str()); + myEventGenerator->InitializeRootOutput(); + m_EventGenerator = myEventGenerator; } //Search for Beam else if (LineBuffer.compare(0, 4, "Beam") == 0 && !check_Beam) { - check_Beam = true ; - VEventGenerator* myEventGenerator = new EventGeneratorBeam() ; - EventGeneratorFile.close() ; - myEventGenerator->ReadConfiguration(Path) ; - EventGeneratorFile.open(Path.c_str()) ; - myEventGenerator->InitializeRootOutput() ; - myEventGenerator->SetTarget(m_detector->GetTarget()) ; - m_EventGenerator = myEventGenerator ; + check_Beam = true; + VEventGenerator* myEventGenerator = new EventGeneratorBeam(); + EventGeneratorFile.close(); + myEventGenerator->ReadConfiguration(Path); + EventGeneratorFile.open(Path.c_str()); + myEventGenerator->InitializeRootOutput(); + myEventGenerator->SetTarget(m_detector->GetTarget()); + m_EventGenerator = myEventGenerator; } @@ -143,26 +143,26 @@ void PrimaryGeneratorAction::ReadEventGeneratorFile(string Path) //Search for Transfert To Resonance else if (LineBuffer.compare(0, 21, "TransfertToResonance") == 0 && !check_TransfertToResonance) { - check_TransfertToResonance = true ; - VEventGenerator* myEventGenerator = new EventGeneratorTransfertToResonance() ; - EventGeneratorFile.close() ; - myEventGenerator->ReadConfiguration(Path) ; - EventGeneratorFile.open(Path.c_str()) ; - myEventGenerator->InitializeRootOutput() ; + check_TransfertToResonance = true; + VEventGenerator* myEventGenerator = new EventGeneratorTransfertToResonance(); + EventGeneratorFile.close(); + myEventGenerator->ReadConfiguration(Path); + EventGeneratorFile.open(Path.c_str()); + myEventGenerator->InitializeRootOutput(); myEventGenerator->SetTarget(m_detector->GetTarget()); - m_EventGenerator = myEventGenerator ; + m_EventGenerator = myEventGenerator; } //Search for Transfert To Resonance else if (LineBuffer.compare(0, 10, "PhaseSpace") == 0 && !check_PhaseSpace) { - check_PhaseSpace = true ; - VEventGenerator* myEventGenerator = new EventGeneratorPhaseSpace() ; - EventGeneratorFile.close() ; - myEventGenerator->ReadConfiguration(Path) ; - EventGeneratorFile.open(Path.c_str()) ; - myEventGenerator->InitializeRootOutput() ; - myEventGenerator->SetTarget(m_detector->GetTarget()) ; - m_EventGenerator = myEventGenerator ; + check_PhaseSpace = true; + VEventGenerator* myEventGenerator = new EventGeneratorPhaseSpace(); + EventGeneratorFile.close(); + myEventGenerator->ReadConfiguration(Path); + EventGeneratorFile.open(Path.c_str()); + myEventGenerator->InitializeRootOutput(); + myEventGenerator->SetTarget(m_detector->GetTarget()); + m_EventGenerator = myEventGenerator; } } EventGeneratorFile.close(); diff --git a/NPSimulation/src/ShieldClParis.cc b/NPSimulation/src/ShieldClParis.cc index f3fe6a464..17d2af2c9 100644 --- a/NPSimulation/src/ShieldClParis.cc +++ b/NPSimulation/src/ShieldClParis.cc @@ -208,8 +208,8 @@ void ShieldClParis::VolumeMaker(G4int DetecNumber, // Mother Volume G4Trap* solidShieldClParis = new G4Trap(Name, Length/2, 16.3543*deg, 225.*deg, - 12.*mm,102.375*mm, 102.375*mm, 0.*deg, - 43.125*mm, 133.5*mm, 133.5*mm,0.*deg); + 12.*mm,102.375*mm, 102.375*mm, 0.*deg, + 43.125*mm, 133.5*mm, 133.5*mm,0.*deg); G4LogicalVolume* logicShieldClParis = new G4LogicalVolume(solidShieldClParis, Vacuum, Name, 0, 0, 0); PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , @@ -227,13 +227,13 @@ void ShieldClParis::VolumeMaker(G4int DetecNumber, G4ThreeVector positionCsI = G4ThreeVector(0, 0, 0); G4Trap* solidShieldCsI = new G4Trap("solidShieldCsI", Length/2, 16.3543*deg, 225.*deg, - 12.*mm,102.375*mm, 102.375*mm, 0.*deg, - 43.125*mm, 133.5*mm, 133.5*mm,0.*deg); + 12.*mm,102.375*mm, 102.375*mm, 0.*deg, + 43.125*mm, 133.5*mm, 133.5*mm,0.*deg); //G4LogicalVolume* logicShieldCsI = new G4LogicalVolume(solidShieldCsI, CsI, "logicShieldCsI", 0, 0, 0); G4LogicalVolume* logicShieldCsI = new G4LogicalVolume(solidShieldCsI, NaI, "logicShieldCsI", 0, 0, 0); PVPBuffer = new G4PVPlacement(0, - positionCsI , + positionCsI , logicShieldCsI , Name + "_ShieldCsI" , logicShieldClParis , @@ -298,7 +298,7 @@ void ShieldClParis::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -410,11 +410,11 @@ void ShieldClParis::ReadConfiguration(string Path) if ((check_A && check_B && check_C && check_D && checkVis) && !(check_Theta && check_Phi && check_R)) { ReadingStatus = false; - check_A = false; - check_C = false; - check_B = false; - check_D = false; - checkVis = false; + check_A = false; + check_C = false; + check_B = false; + check_D = false; + checkVis = false; AddModule(A, B, C, D); } @@ -424,11 +424,11 @@ void ShieldClParis::ReadConfiguration(string Path) !(check_A && check_B && check_C && check_D)) { ReadingStatus = false; check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - checkVis = false; - + check_Phi = false; + check_R = false; + check_beta = false; + checkVis = false; + AddModule(R, Theta, Phi, beta_u, beta_v, beta_w); } } @@ -647,90 +647,90 @@ void ShieldClParis::ReadSensitive(const G4Event* event) if(sizeN>1) - { - CsIShieldEnergy_itr++; - CsIShieldTime_itr++; - CsIShieldDetectorNumber_itr++; + { + CsIShieldEnergy_itr++; + CsIShieldTime_itr++; + CsIShieldDetectorNumber_itr++; - for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks + for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks - G4int N= *(CsIShieldDetectorNumber_itr->second); // ID of det hit - NTrackID = CsIShieldDetectorNumber_itr->first - N; // ID of the track + G4int N= *(CsIShieldDetectorNumber_itr->second); // ID of det hit + NTrackID = CsIShieldDetectorNumber_itr->first - N; // ID of the track - //G4cout <<"l=" << l << G4endl; - //G4cout <<"N=" << N << G4endl; - //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; - //G4cout <<"NTrackID=" << NTrackID << G4endl; + //G4cout <<"l=" << l << G4endl; + //G4cout <<"N=" << N << G4endl; + //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; + //G4cout <<"NTrackID=" << NTrackID << G4endl; - if(N==N_first) - { - E += *(CsIShieldEnergy_itr->second); + if(N==N_first) + { + E += *(CsIShieldEnergy_itr->second); - }else // we fill the tree for the first detector hit and move to the next detector hit - { - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldCl"] + N_first); - ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldCl"] + N_first); - // Fill Energy - // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); + }else // we fill the tree for the first detector hit and move to the next detector hit + { + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldCl"] + N_first); + ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldCl"] + N_first); + // Fill Energy + // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); - // Fill Time - ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); + // Fill Time + ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); - } + } - N_first=N; - E=*(CsIShieldEnergy_itr->second); + N_first=N; + E=*(CsIShieldEnergy_itr->second); - } + } - //G4cout <<"Energy=" << E << G4endl; - //G4cout <<"Time =" << T << G4endl; + //G4cout <<"Energy=" << E << G4endl; + //G4cout <<"Time =" << T << G4endl; - // Always fill the tree at the end of the loop: - if(l==(sizeN-1) && E!=0) - { - // Fill detector number - ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldCl"] + N_first); - ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldCl"] + N_first); - // Fill Energy - // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); - // Fill Time - ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - - CsIShieldEnergy_itr++; - CsIShieldDetectorNumber_itr++; - } - }else - { - // Fill the tree if sizeN=1: - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldCl"] + N_first); - ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldCl"] + N_first); - // Fill Energy - // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); - - // Fill Time - ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - } - + // Always fill the tree at the end of the loop: + if(l==(sizeN-1) && E!=0) + { + // Fill detector number + ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldCl"] + N_first); + ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldCl"] + N_first); + // Fill Energy + // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); + // Fill Time + ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + + CsIShieldEnergy_itr++; + CsIShieldDetectorNumber_itr++; + } + }else + { + // Fill the tree if sizeN=1: + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldCl"] + N_first); + ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldCl"] + N_first); + // Fill Energy + // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); + + // Fill Time + ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + } + } diff --git a/NPSimulation/src/ShieldPhParis.cc b/NPSimulation/src/ShieldPhParis.cc index 8d8edc55d..87feef285 100644 --- a/NPSimulation/src/ShieldPhParis.cc +++ b/NPSimulation/src/ShieldPhParis.cc @@ -221,34 +221,34 @@ void ShieldPhParis::VolumeMaker(G4int DetecNumber, G4LogicalVolume* logicShieldPhParis = new G4LogicalVolume(solidShieldPhParis, Vacuum, Name, 0, 0, 0); - PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , - logicShieldPhParis , - Name , - world , - false , - 0); + PVPBuffer = new G4PVPlacement( G4Transform3D(*MMrot, MMpos), + logicShieldPhParis, + Name, + world, + false, + 0); logicShieldPhParis->SetVisAttributes(G4VisAttributes::Invisible); //if (m_non_sensitive_part_visiualisation) logicShieldPhParis->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); // Daughter Volume // CsI - G4ThreeVector positionCsI = G4ThreeVector(0, 0, 0); + G4ThreeVector positionCsI = G4ThreeVector(0, 0, 0); - G4Polyhedra* solidShield = new G4Polyhedra("solidShield",0.*deg, 360.*deg, 3, 2, z_values, Rmin_values, Rmax_values); + G4Polyhedra* solidShield = new G4Polyhedra("solidShield",0.*deg, 360.*deg, 3, 2, z_values, Rmin_values, Rmax_values); - G4SubtractionSolid* solidShieldCsI = new G4SubtractionSolid("solidShieldCsI",solidShield, solidSubtractBox, 0, G4ThreeVector(0.,0.,Length/2)); + G4SubtractionSolid* solidShieldCsI = new G4SubtractionSolid("solidShieldCsI",solidShield, solidSubtractBox, 0, G4ThreeVector(0.,0.,Length/2)); //G4LogicalVolume* logicShieldCsI = new G4LogicalVolume(solidShieldCsI, CsI, "logicShieldCsI", 0, 0, 0); G4LogicalVolume* logicShieldCsI = new G4LogicalVolume(solidShieldCsI, NaI, "logicShieldCsI", 0, 0, 0); - PVPBuffer = new G4PVPlacement(0, - positionCsI , - logicShieldCsI , - Name + "_ShieldCsI" , - logicShieldPhParis , - false , - 0); + PVPBuffer = new G4PVPlacement( 0, + positionCsI, + logicShieldCsI, + Name + "_ShieldCsI", + logicShieldPhParis, + false, + 0); // Set CsI sensible logicShieldCsI->SetSensitiveDetector(m_CsIShieldScorer); @@ -308,7 +308,7 @@ void ShieldPhParis::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} - + // Position method else if (DataBuffer.compare(0, 6, "X1_Y1=") == 0) { check_A = true; @@ -420,11 +420,11 @@ void ShieldPhParis::ReadConfiguration(string Path) if ((check_A && check_B && check_C && check_D && checkVis) && !(check_Theta && check_Phi && check_R)) { ReadingStatus = false; - check_A = false; - check_C = false; - check_B = false; - check_D = false; - checkVis = false; + check_A = false; + check_C = false; + check_B = false; + check_D = false; + checkVis = false; AddModule(A, B, C, D); } @@ -434,11 +434,11 @@ void ShieldPhParis::ReadConfiguration(string Path) !(check_A && check_B && check_C && check_D)) { ReadingStatus = false; check_Theta = false; - check_Phi = false; - check_R = false; - check_beta = false; - checkVis = false; - + check_Phi = false; + check_R = false; + check_beta = false; + checkVis = false; + AddModule(R, Theta, Phi, beta_u, beta_v, beta_w); } } @@ -657,89 +657,89 @@ void ShieldPhParis::ReadSensitive(const G4Event* event) if(sizeN>1) - { - CsIShieldEnergy_itr++; - CsIShieldTime_itr++; - CsIShieldDetectorNumber_itr++; + { + CsIShieldEnergy_itr++; + CsIShieldTime_itr++; + CsIShieldDetectorNumber_itr++; - for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks + for (G4int l = 1; l < sizeN ; l++) { // loop on all the other tracks - G4int N= *(CsIShieldDetectorNumber_itr->second); // ID of det hit - NTrackID = CsIShieldDetectorNumber_itr->first - N; // ID of the track - - //G4cout <<"l=" << l << G4endl; - //G4cout <<"N=" << N << G4endl; - //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; - //G4cout <<"NTrackID=" << NTrackID << G4endl; - - if(N==N_first) - { - E += *(CsIShieldEnergy_itr->second); - - }else // we fill the tree for the first detector hit and move to the next detector hit - { - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldPh"] + N_first); - ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldPh"] + N_first); - // Fill Energy - // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); - // Fill Time - ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); - - } - - N_first=N; - E=*(CsIShieldEnergy_itr->second); - - } - - - //G4cout <<"Energy=" << E << G4endl; - //G4cout <<"Time =" << T << G4endl; + G4int N= *(CsIShieldDetectorNumber_itr->second); // ID of det hit + NTrackID = CsIShieldDetectorNumber_itr->first - N; // ID of the track + + //G4cout <<"l=" << l << G4endl; + //G4cout <<"N=" << N << G4endl; + //G4cout <<"DetectorNumber_itr->first =" << DetectorNumber_itr->first << G4endl; + //G4cout <<"NTrackID=" << NTrackID << G4endl; + + if(N==N_first) + { + E += *(CsIShieldEnergy_itr->second); + + }else // we fill the tree for the first detector hit and move to the next detector hit + { + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldPh"] + N_first); + ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldPh"] + N_first); + // Fill Energy + // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); + // Fill Time + ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); + + } + + N_first=N; + E=*(CsIShieldEnergy_itr->second); + + } + + + //G4cout <<"Energy=" << E << G4endl; + //G4cout <<"Time =" << T << G4endl; - // Always fill the tree at the end of the loop: - if(l==(sizeN-1) && E!=0) - { - // Fill detector number - ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldPh"] + N_first); - ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldPh"] + N_first); - // Fill Energy - // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); - // Fill Time - ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - - CsIShieldEnergy_itr++; - CsIShieldDetectorNumber_itr++; - } - }else - { - // Fill the tree if sizeN=1: - if(E!=0) - { - // Fill detector number - ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldPh"] + N_first); - ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldPh"] + N_first); - // Fill Energy - // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); - E=RandGauss::shoot(E, ResoFirstStage); - ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree - if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); - - // Fill Time - ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); - } - } - + // Always fill the tree at the end of the loop: + if(l==(sizeN-1) && E!=0) + { + // Fill detector number + ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldPh"] + N_first); + ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldPh"] + N_first); + // Fill Energy + // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); + // Fill Time + ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + + CsIShieldEnergy_itr++; + CsIShieldDetectorNumber_itr++; + } + }else + { + // Fill the tree if sizeN=1: + if(E!=0) + { + // Fill detector number + ms_Event->SetPARISCsIShieldEDetectorNbr(m_index["ShieldPh"] + N_first); + ms_Event->SetPARISCsIShieldTDetectorNbr(m_index["ShieldPh"] + N_first); + // Fill Energy + // ms_Event->SetPARISCsIShieldEEnergy(RandGauss::shoot(E, ResoFirstStage)); + E=RandGauss::shoot(E, ResoFirstStage); + ms_Event->SetPARISCsIShieldEEnergy(E); // Fill the tree + if(E>EGammaMin && E<EGammaMax) ms_Event->SetPARISCsIShieldEffphpeak(EGamma); + + // Fill Time + ms_Event->SetPARISCsIShieldTTime(RandGauss::shoot(T, ResoTimeGpd)); + } + } + } diff --git a/NPSimulation/src/Target.cc b/NPSimulation/src/Target.cc index aa668a364..a0d85eb46 100644 --- a/NPSimulation/src/Target.cc +++ b/NPSimulation/src/Target.cc @@ -57,14 +57,14 @@ using namespace std; // Specific Method of this class Target::Target() { - m_TargetType = true; - m_TargetThickness = 0 ; - m_TargetAngle = 0 ; - m_TargetRadius = 0 ; + m_TargetType = true; + m_TargetThickness = 0 ; + m_TargetAngle = 0 ; + m_TargetRadius = 0 ; m_WindowsThickness = 0 ; m_TargetTemperature = 0 ; - m_TargetPressure = 0 ; - m_TargetNbLayers = 50; // Number of steps by default + m_TargetPressure = 0 ; + m_TargetNbLayers = 50; // Number of steps by default } G4Material* Target::GetMaterialFromLibrary(G4String MaterialName, G4double Temperature, G4double Pressure) @@ -121,14 +121,14 @@ G4Material* Target::GetMaterialFromLibrary(G4String MaterialName, G4double Tempe G4cout << "CryoTarget temp set to 26K" << G4endl; } - - else if (Pressure == 0.7) { + + else if (Pressure == 0.7) { G4cout << "CryoTarget pressure set to 0.7 bar" << G4endl; - if (Temperature == 26) { - density = 0.0013125 * g / cm3; - G4cout << "CryoTarget temp set to 26K" << G4endl; - } + if (Temperature == 26) { + density = 0.0013125 * g / cm3; + G4cout << "CryoTarget temp set to 26K" << G4endl; + } } @@ -251,7 +251,7 @@ void Target::ReadConfiguration(string Path) ConfigFile.open(Path.c_str()); string LineBuffer; string DataBuffer; - + bool ReadingStatusTarget = false ; bool ReadingStatusCryoTarget = false ; @@ -268,7 +268,7 @@ void Target::ReadConfiguration(string Path) bool check_Pressure = false ; bool check_WinThickness = false ; bool check_WinMaterial = false ; - + while (!ConfigFile.eof()) { getline(ConfigFile, LineBuffer); if (LineBuffer.compare(0, 6, "Target") == 0) { @@ -284,172 +284,172 @@ void Target::ReadConfiguration(string Path) while (ReadingStatusTarget) { ConfigFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - else if (DataBuffer.compare(0, 10, "THICKNESS=") == 0) { - check_Thickness = true ; - ConfigFile >> DataBuffer; - m_TargetThickness = atof(DataBuffer.c_str()) * micrometer; - cout << "Target Thickness: " << m_TargetThickness / micrometer << " micrometer" << endl; - } - - else if (DataBuffer.compare(0, 6, "ANGLE=") == 0) { - check_Angle = true ; - ConfigFile >> DataBuffer; - m_TargetAngle = atof(DataBuffer.c_str()) * deg; - cout << "Target Angle: " << m_TargetAngle / deg << endl ; - } - - else if (DataBuffer.compare(0, 7, "RADIUS=") == 0) { - check_Radius = true ; - ConfigFile >> DataBuffer; - m_TargetRadius = atof(DataBuffer.c_str()) * mm; - cout << "Target Radius: " << m_TargetRadius / mm << " mm " << endl; - } - - else if (DataBuffer.compare(0, 9, "MATERIAL=") == 0) { - check_Material = true ; - ConfigFile >> DataBuffer; - m_TargetMaterial = GetMaterialFromLibrary(DataBuffer); - cout << "Target Material: " << m_TargetMaterial << endl ; - } - - else if (DataBuffer.compare(0, 2, "X=") == 0) { - check_X = true ; - ConfigFile >> DataBuffer; - m_TargetX = atof(DataBuffer.c_str()) * mm; - cout << "Target coordinate (mm): ( " << m_TargetX / mm << " ; "; - } - - else if (DataBuffer.compare(0, 2, "Y=") == 0) { - check_Y = true ; - ConfigFile >> DataBuffer; - m_TargetY = atof(DataBuffer.c_str()) * mm; - cout << m_TargetY / mm << " ; "; - } - - else if (DataBuffer.compare(0, 2, "Z=") == 0) { - check_Z = true ; - ConfigFile >> DataBuffer; - m_TargetZ = atof(DataBuffer.c_str()) * mm; - cout << m_TargetZ / mm << " )" << endl ; - } - - else if (DataBuffer.compare(0, 9, "NBLAYERS=") == 0) { - check_m_TargetNbLayers = true ; - ConfigFile >> DataBuffer; - m_TargetNbLayers = atoi(DataBuffer.c_str()); - cout << "Number of steps for slowing down the beam in target: " << m_TargetNbLayers << endl; - } - - /////////////////////////////////////////////////// - // If no Beam Token and no comment, toggle out - else - {ReadingStatusTarget = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if( check_Thickness && check_Radius && check_Material && check_X && check_Y && check_Z ) - ReadingStatusTarget = false ; - - } - - while(ReadingStatusCryoTarget){ + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + else if (DataBuffer.compare(0, 10, "THICKNESS=") == 0) { + check_Thickness = true ; + ConfigFile >> DataBuffer; + m_TargetThickness = atof(DataBuffer.c_str()) * micrometer; + cout << "Target Thickness: " << m_TargetThickness / micrometer << " micrometer" << endl; + } + + else if (DataBuffer.compare(0, 6, "ANGLE=") == 0) { + check_Angle = true ; + ConfigFile >> DataBuffer; + m_TargetAngle = atof(DataBuffer.c_str()) * deg; + cout << "Target Angle: " << m_TargetAngle / deg << endl ; + } + + else if (DataBuffer.compare(0, 7, "RADIUS=") == 0) { + check_Radius = true ; + ConfigFile >> DataBuffer; + m_TargetRadius = atof(DataBuffer.c_str()) * mm; + cout << "Target Radius: " << m_TargetRadius / mm << " mm " << endl; + } + + else if (DataBuffer.compare(0, 9, "MATERIAL=") == 0) { + check_Material = true ; + ConfigFile >> DataBuffer; + m_TargetMaterial = GetMaterialFromLibrary(DataBuffer); + cout << "Target Material: " << m_TargetMaterial << endl ; + } + + else if (DataBuffer.compare(0, 2, "X=") == 0) { + check_X = true ; + ConfigFile >> DataBuffer; + m_TargetX = atof(DataBuffer.c_str()) * mm; + cout << "Target coordinate (mm): ( " << m_TargetX / mm << " ; "; + } + + else if (DataBuffer.compare(0, 2, "Y=") == 0) { + check_Y = true ; + ConfigFile >> DataBuffer; + m_TargetY = atof(DataBuffer.c_str()) * mm; + cout << m_TargetY / mm << " ; "; + } + + else if (DataBuffer.compare(0, 2, "Z=") == 0) { + check_Z = true ; + ConfigFile >> DataBuffer; + m_TargetZ = atof(DataBuffer.c_str()) * mm; + cout << m_TargetZ / mm << " )" << endl ; + } + + else if (DataBuffer.compare(0, 9, "NBLAYERS=") == 0) { + check_m_TargetNbLayers = true ; + ConfigFile >> DataBuffer; + m_TargetNbLayers = atoi(DataBuffer.c_str()); + cout << "Number of steps for slowing down the beam in target: " << m_TargetNbLayers << endl; + } + + /////////////////////////////////////////////////// + // If no Beam Token and no comment, toggle out + else + {ReadingStatusTarget = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if( check_Thickness && check_Radius && check_Material && check_X && check_Y && check_Z ) + ReadingStatusTarget = false ; + + } + + while(ReadingStatusCryoTarget){ - ConfigFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) {/*Do Nothing*/;} - - else if (DataBuffer.compare(0, 10, "THICKNESS=") == 0) { - check_Thickness = true ; - ConfigFile >> DataBuffer; - m_TargetThickness = atof(DataBuffer.c_str()) * micrometer; - cout << "Target Thickness: " << m_TargetThickness / micrometer << "um" << endl ; - } - - else if (DataBuffer.compare(0, 7, "RADIUS=") == 0) { - check_Radius = true ; - ConfigFile >> DataBuffer; - m_TargetRadius = atof(DataBuffer.c_str()) * mm; - cout << "Target Radius: " << m_TargetRadius / mm << "mm" << endl ; - } - - else if (DataBuffer.compare(0, 12, "TEMPERATURE=") == 0) { - check_Temperature = true ; - ConfigFile >> DataBuffer; - m_TargetTemperature = atof(DataBuffer.c_str()); - } - - else if (DataBuffer.compare(0, 9, "PRESSURE=") == 0) { - check_Pressure = true ; - ConfigFile >> DataBuffer; - m_TargetPressure = atof(DataBuffer.c_str()); - } - - else if (DataBuffer.compare(0, 9, "MATERIAL=") == 0) { - check_Material = true ; - ConfigFile >> DataBuffer; - m_TargetMaterial = GetMaterialFromLibrary(DataBuffer, m_TargetTemperature, m_TargetPressure); - cout << "Target Material: " << m_TargetMaterial << endl ; - } - - else if (DataBuffer.compare(0, 17, "WINDOWSTHICKNESS=") == 0) { - check_WinThickness = true ; - ConfigFile >> DataBuffer; - m_WindowsThickness = atof(DataBuffer.c_str()) * micrometer; - cout << "Windows Thickness: " << m_WindowsThickness / micrometer << "um" << endl ; - } - - else if (DataBuffer.compare(0, 16, "WINDOWSMATERIAL=") == 0) { - check_WinMaterial = true ; - ConfigFile >> DataBuffer; - m_WindowsMaterial = GetMaterialFromLibrary(DataBuffer); - cout << "Windows Material: " << m_WindowsMaterial << endl ; - } - - else if (DataBuffer.compare(0, 2, "X=") == 0) { - check_X = true ; - ConfigFile >> DataBuffer; - m_TargetX = atof(DataBuffer.c_str()) * mm; - cout << "Target coordinate (mm): ( " << m_TargetX / mm << " ; "; - } - - else if (DataBuffer.compare(0, 2, "Y=") == 0) { - check_Y = true ; - ConfigFile >> DataBuffer; - m_TargetY = atof(DataBuffer.c_str()) * mm; - cout << m_TargetY / mm << " ; "; - } - - else if (DataBuffer.compare(0, 2, "Z=") == 0) { - check_Z = true ; - ConfigFile >> DataBuffer; - m_TargetZ = atof(DataBuffer.c_str()) * mm; - cout << m_TargetZ / mm << " )" << endl ; - } - - else if (DataBuffer.compare(0, 9, "NBLAYERS=") == 0) { - check_m_TargetNbLayers = true ; - ConfigFile >> DataBuffer; - m_TargetNbLayers = atoi(DataBuffer.c_str()); - cout << "Number of steps for slowing down the beam in target: " << m_TargetNbLayers << endl; - } - - /////////////////////////////////////////////////// - // If no Beam Token and no comment, toggle out - else - {ReadingStatusCryoTarget = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if( check_Thickness && check_Radius && check_Material && check_X && check_Y && check_Z && check_WinThickness && check_WinMaterial && check_Pressure && check_Temperature) - ReadingStatusCryoTarget = false ; - - } - + ConfigFile >> DataBuffer; + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) {/*Do Nothing*/;} + + else if (DataBuffer.compare(0, 10, "THICKNESS=") == 0) { + check_Thickness = true ; + ConfigFile >> DataBuffer; + m_TargetThickness = atof(DataBuffer.c_str()) * micrometer; + cout << "Target Thickness: " << m_TargetThickness / micrometer << "um" << endl ; + } + + else if (DataBuffer.compare(0, 7, "RADIUS=") == 0) { + check_Radius = true ; + ConfigFile >> DataBuffer; + m_TargetRadius = atof(DataBuffer.c_str()) * mm; + cout << "Target Radius: " << m_TargetRadius / mm << "mm" << endl ; + } + + else if (DataBuffer.compare(0, 12, "TEMPERATURE=") == 0) { + check_Temperature = true ; + ConfigFile >> DataBuffer; + m_TargetTemperature = atof(DataBuffer.c_str()); + } + + else if (DataBuffer.compare(0, 9, "PRESSURE=") == 0) { + check_Pressure = true ; + ConfigFile >> DataBuffer; + m_TargetPressure = atof(DataBuffer.c_str()); + } + + else if (DataBuffer.compare(0, 9, "MATERIAL=") == 0) { + check_Material = true ; + ConfigFile >> DataBuffer; + m_TargetMaterial = GetMaterialFromLibrary(DataBuffer, m_TargetTemperature, m_TargetPressure); + cout << "Target Material: " << m_TargetMaterial << endl ; + } + + else if (DataBuffer.compare(0, 17, "WINDOWSTHICKNESS=") == 0) { + check_WinThickness = true ; + ConfigFile >> DataBuffer; + m_WindowsThickness = atof(DataBuffer.c_str()) * micrometer; + cout << "Windows Thickness: " << m_WindowsThickness / micrometer << "um" << endl ; + } + + else if (DataBuffer.compare(0, 16, "WINDOWSMATERIAL=") == 0) { + check_WinMaterial = true ; + ConfigFile >> DataBuffer; + m_WindowsMaterial = GetMaterialFromLibrary(DataBuffer); + cout << "Windows Material: " << m_WindowsMaterial << endl ; + } + + else if (DataBuffer.compare(0, 2, "X=") == 0) { + check_X = true ; + ConfigFile >> DataBuffer; + m_TargetX = atof(DataBuffer.c_str()) * mm; + cout << "Target coordinate (mm): ( " << m_TargetX / mm << " ; "; + } + + else if (DataBuffer.compare(0, 2, "Y=") == 0) { + check_Y = true ; + ConfigFile >> DataBuffer; + m_TargetY = atof(DataBuffer.c_str()) * mm; + cout << m_TargetY / mm << " ; "; + } + + else if (DataBuffer.compare(0, 2, "Z=") == 0) { + check_Z = true ; + ConfigFile >> DataBuffer; + m_TargetZ = atof(DataBuffer.c_str()) * mm; + cout << m_TargetZ / mm << " )" << endl ; + } + + else if (DataBuffer.compare(0, 9, "NBLAYERS=") == 0) { + check_m_TargetNbLayers = true ; + ConfigFile >> DataBuffer; + m_TargetNbLayers = atoi(DataBuffer.c_str()); + cout << "Number of steps for slowing down the beam in target: " << m_TargetNbLayers << endl; + } + + /////////////////////////////////////////////////// + // If no Beam Token and no comment, toggle out + else + {ReadingStatusCryoTarget = false; G4cout << "WARNING : Wrong Token Sequence: Getting out " << G4endl ;} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if( check_Thickness && check_Radius && check_Material && check_X && check_Y && check_Z && check_WinThickness && check_WinMaterial && check_Pressure && check_Temperature) + ReadingStatusCryoTarget = false ; + + } + } @@ -464,7 +464,7 @@ void Target::ConstructDetector(G4LogicalVolume* world) // If don't you will have a Warning unused variable 'myPVP' G4VPhysicalVolume* PVPBuffer ; - if (m_TargetType) { // case of standard target + if (m_TargetType) { // case of standard target if (m_TargetThickness > 0) { G4Tubs* solidTarget = new G4Tubs("solidTarget", 0, m_TargetRadius, 0.5*m_TargetThickness, 0*deg, 360*deg); @@ -482,7 +482,7 @@ void Target::ConstructDetector(G4LogicalVolume* world) } } - else { // case of cryogenic target + else { // case of cryogenic target if (m_TargetThickness > 0) { G4Tubs* solidTarget = new G4Tubs("solidTarget", 0, m_TargetRadius, 0.5*m_TargetThickness, 0*deg, 360*deg); @@ -507,20 +507,20 @@ void Target::ConstructDetector(G4LogicalVolume* world) G4LogicalVolume* logicWindowsB = new G4LogicalVolume(solidWindowsB, m_WindowsMaterial, "logicTargetWindowsB"); PVPBuffer = - new G4PVPlacement( 0 , - TargetPos + G4ThreeVector(0., 0., 0.5*(m_TargetThickness + m_WindowsThickness)) , - logicWindowsF , - "Target Window Front" , - world , - false, 0 ); + new G4PVPlacement( 0 , + TargetPos + G4ThreeVector(0., 0., 0.5*(m_TargetThickness + m_WindowsThickness)) , + logicWindowsF , + "Target Window Front" , + world , + false, 0 ); PVPBuffer = - new G4PVPlacement( 0 , - TargetPos + G4ThreeVector(0., 0., -0.5*(m_TargetThickness + m_WindowsThickness)) , - logicWindowsB , - "Target Window Back" , - world , - false, 0 ); + new G4PVPlacement( 0 , + TargetPos + G4ThreeVector(0., 0., -0.5*(m_TargetThickness + m_WindowsThickness)) , + logicWindowsB , + "Target Window Back" , + world , + false, 0 ); G4VisAttributes* WindowsVisAtt = new G4VisAttributes(G4Colour(0.5, 1., 0.5)); logicWindowsF->SetVisAttributes(WindowsVisAtt); @@ -539,21 +539,21 @@ void Target::InitializeRootOutput() // Called at in the EventAction::EndOfEventAvtion void Target::ReadSensitive(const G4Event*) {} - -void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double MeanPosTheta, double SigmaPosTheta, - double MeanPosY, double SigmaPosY, double MeanPosPhi, double SigmaPosPhi, - double IncidentBeamEnergy, - G4ParticleDefinition* BeamName, - G4ThreeVector &InterCoord, double &AngleEmittanceTheta, double &AngleEmittancePhi, - double &AngleIncidentTheta, double &AngleIncidentPhi, - double &FinalBeamEnergy) + +void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double MeanPosTheta, double SigmaPosTheta, + double MeanPosY, double SigmaPosY, double MeanPosPhi, double SigmaPosPhi, + double IncidentBeamEnergy, + G4ParticleDefinition* BeamName, + G4ThreeVector &InterCoord, double &AngleEmittanceTheta, double &AngleEmittancePhi, + double &AngleIncidentTheta, double &AngleIncidentPhi, + double &FinalBeamEnergy) { // target parameters - G4ThreeVector TargetNormal = G4ThreeVector( sin(m_TargetAngle) , - 0 , - cos(m_TargetAngle) ); - + G4ThreeVector TargetNormal = G4ThreeVector( sin(m_TargetAngle) , + 0 , + cos(m_TargetAngle) ); + // beam interaction parameters double x0 = 1000 * cm; double y0 = 1000 * cm; @@ -561,7 +561,7 @@ void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double double dz = 0 * cm; // calculate emittance parameters (x,theta) and (y,phi) - if (m_TargetRadius != 0) { // case of finite target dimensions + if (m_TargetRadius != 0) { // case of finite target dimensions while (sqrt(x0*x0 + y0*y0) > m_TargetRadius) { RandomGaussian2D(MeanPosX, MeanPosTheta, SigmaPosX, SigmaPosTheta, x0, AngleEmittanceTheta); RandomGaussian2D(MeanPosY, MeanPosPhi, SigmaPosY, SigmaPosPhi, y0, AngleEmittancePhi); @@ -570,7 +570,7 @@ void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double // x is the vertical axis dz = x0 * tan(m_TargetAngle); } - else { // if no target radius is given consider a point-like target + else { // if no target radius is given consider a point-like target RandomGaussian2D(0, 0, 0, SigmaPosTheta, x0, AngleEmittanceTheta); RandomGaussian2D(0, 0, 0, SigmaPosPhi, y0, AngleEmittancePhi); } @@ -579,12 +579,12 @@ void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double double Xdir = sin(AngleEmittanceTheta); double Ydir = sin(AngleEmittancePhi); double Zdir = cos(AngleEmittanceTheta) + cos(AngleEmittancePhi); - G4ThreeVector BeamDir = G4ThreeVector(Xdir,Ydir,Zdir) ; - - AngleIncidentTheta = BeamDir.theta() ; - AngleIncidentPhi = BeamDir.phi() ; - if (AngleIncidentPhi < 0) AngleIncidentPhi += 2*pi ; - if (AngleIncidentTheta < 1e-6) AngleIncidentPhi = 0 ; + G4ThreeVector BeamDir = G4ThreeVector(Xdir,Ydir,Zdir) ; + + AngleIncidentTheta = BeamDir.theta() ; + AngleIncidentPhi = BeamDir.phi() ; + if (AngleIncidentPhi < 0) AngleIncidentPhi += 2*pi ; + if (AngleIncidentTheta < 1e-6) AngleIncidentPhi = 0 ; // effective target thickness is dz and z-position of interaction // when the target is tilted wrt the beam axis @@ -601,41 +601,41 @@ void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double z0 += m_TargetZ; InterCoord = G4ThreeVector(x0, y0, z0); - if(m_TargetType) - { - G4EmCalculator emCalculator; - if(m_TargetThickness!=0) - { - for (G4int i = 0; i < m_TargetNbLayers; i++) - { - G4double dedx = emCalculator.ComputeTotalDEDX(IncidentBeamEnergy, BeamName, m_TargetMaterial); - G4double de = dedx * EffectiveTargetThicknessBeforeInteraction / m_TargetNbLayers; - IncidentBeamEnergy -= de; - } - } - } - - else - { G4EmCalculator emCalculator; - // Windows - if(m_WindowsThickness!=0) - for (G4int i = 0; i < m_TargetNbLayers; i++) - { - G4double dedx = emCalculator.ComputeTotalDEDX(IncidentBeamEnergy, BeamName, m_WindowsMaterial); - G4double de = dedx * m_WindowsThickness * uniform / (cos(AngleIncidentTheta)*m_TargetNbLayers); - IncidentBeamEnergy -= de; - } - - // Target - if(m_TargetThickness!=0) - for (G4int i = 0; i < m_TargetNbLayers; i++) - { - G4double dedx = emCalculator.ComputeTotalDEDX(IncidentBeamEnergy, BeamName, m_TargetMaterial); - G4double de = dedx * EffectiveTargetThicknessBeforeInteraction / m_TargetNbLayers; - IncidentBeamEnergy -= de; - } - } - + if(m_TargetType) + { + G4EmCalculator emCalculator; + if(m_TargetThickness!=0) + { + for (G4int i = 0; i < m_TargetNbLayers; i++) + { + G4double dedx = emCalculator.ComputeTotalDEDX(IncidentBeamEnergy, BeamName, m_TargetMaterial); + G4double de = dedx * EffectiveTargetThicknessBeforeInteraction / m_TargetNbLayers; + IncidentBeamEnergy -= de; + } + } + } + + else + { G4EmCalculator emCalculator; + // Windows + if(m_WindowsThickness!=0) + for (G4int i = 0; i < m_TargetNbLayers; i++) + { + G4double dedx = emCalculator.ComputeTotalDEDX(IncidentBeamEnergy, BeamName, m_WindowsMaterial); + G4double de = dedx * m_WindowsThickness * uniform / (cos(AngleIncidentTheta)*m_TargetNbLayers); + IncidentBeamEnergy -= de; + } + + // Target + if(m_TargetThickness!=0) + for (G4int i = 0; i < m_TargetNbLayers; i++) + { + G4double dedx = emCalculator.ComputeTotalDEDX(IncidentBeamEnergy, BeamName, m_TargetMaterial); + G4double de = dedx * EffectiveTargetThicknessBeforeInteraction / m_TargetNbLayers; + IncidentBeamEnergy -= de; + } + } + FinalBeamEnergy=IncidentBeamEnergy; } @@ -660,46 +660,46 @@ void Target::RandomGaussian2D(double MeanX, double MeanY, double SigmaX, double } } -// Generate a DEDX file table using the material used in the target +// Generate a DEDX file table using the material used in the target void Target::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4double Emax) - { - // Opening hte output file - G4String GlobalPath = getenv("NPTOOL"); - G4String Path = GlobalPath + "/Inputs/EnergyLoss/" + Particle->GetParticleName() + "_" + m_TargetMaterial->GetName() + ".G4table"; - - ofstream File ; - File.open(Path) ; - - if(!File) return ; - - File << "Table from Geant4 generate using NPSimulation \t" - << "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_TargetMaterial->GetName() << endl ; - - G4EmCalculator emCalculator; - - for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/10000.) - { - G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_TargetMaterial); - File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; - } - File.close(); - - if(!m_TargetType) - { - G4String Path = GlobalPath + "/Inputs/EnergyLoss/" + Particle->GetParticleName() + "_" + m_WindowsMaterial->GetName() + ".G4table"; - File.open(Path) ; - if(!File) return ; - File << "Table from Geant4 generate using NPSimulation \t " - << "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_WindowsMaterial->GetName() << endl ; - - for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/10000.) - { -// G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_WindowsMaterial); - G4double dedx = emCalculator.ComputeDEDX( E, Particle , - "ionIoni", m_WindowsMaterial); - File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; - } - } - File.close(); - - } + { + // Opening hte output file + G4String GlobalPath = getenv("NPTOOL"); + G4String Path = GlobalPath + "/Inputs/EnergyLoss/" + Particle->GetParticleName() + "_" + m_TargetMaterial->GetName() + ".G4table"; + + ofstream File ; + File.open(Path) ; + + if(!File) return ; + + File << "Table from Geant4 generate using NPSimulation \t" + << "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_TargetMaterial->GetName() << endl ; + + G4EmCalculator emCalculator; + + for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/10000.) + { + G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_TargetMaterial); + File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; + } + File.close(); + + if(!m_TargetType) + { + G4String Path = GlobalPath + "/Inputs/EnergyLoss/" + Particle->GetParticleName() + "_" + m_WindowsMaterial->GetName() + ".G4table"; + File.open(Path) ; + if(!File) return ; + File << "Table from Geant4 generate using NPSimulation \t " + << "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_WindowsMaterial->GetName() << endl ; + + for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/10000.) + { +// G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_WindowsMaterial); + G4double dedx = emCalculator.ComputeDEDX( E, Particle , + "ionIoni", m_WindowsMaterial); + File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; + } + } + File.close(); + + } diff --git a/NPSimulation/src/ThinSi.cc b/NPSimulation/src/ThinSi.cc index cff1647f8..aaaee54e7 100644 --- a/NPSimulation/src/ThinSi.cc +++ b/NPSimulation/src/ThinSi.cc @@ -62,74 +62,74 @@ using namespace CLHEP; // ThinSi Specific Method ThinSi::ThinSi() { - InitializeMaterial() ; - m_Event = new TSSSDData() ; + InitializeMaterial(); + m_Event = new TSSSDData(); } ThinSi::~ThinSi() { - delete m_MaterialSilicon ; - delete m_MaterialAl ; - delete m_MaterialVacuum ; + delete m_MaterialSilicon; + delete m_MaterialAl; + delete m_MaterialVacuum; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void ThinSi::AddTelescope(G4ThreeVector TL , - G4ThreeVector BL , - G4ThreeVector BR , - G4ThreeVector TR ) +void ThinSi::AddTelescope( G4ThreeVector TL, + G4ThreeVector BL, + G4ThreeVector BR, + G4ThreeVector TR) { - m_DefinitionType.push_back(true) ; - - m_TL.push_back(TL) ; - m_BL.push_back(BL) ; - m_BR.push_back(BR) ; - m_TR.push_back(TR) ; - - m_R.push_back(0) ; - m_Theta.push_back(0) ; - m_Phi.push_back(0) ; - m_beta_u.push_back(0) ; - m_beta_v.push_back(0) ; - m_beta_w.push_back(0) ; + m_DefinitionType.push_back(true); + + m_TL.push_back(TL); + m_BL.push_back(BL); + m_BR.push_back(BR); + m_TR.push_back(TR); + + m_R.push_back(0); + m_Theta.push_back(0); + m_Phi.push_back(0); + m_beta_u.push_back(0); + m_beta_v.push_back(0); + m_beta_w.push_back(0); } -void ThinSi::AddTelescope(G4double R , - G4double Theta , - G4double Phi , - G4double beta_u , - G4double beta_v , - G4double beta_w ) +void ThinSi::AddTelescope( G4double R, + G4double Theta, + G4double Phi, + G4double beta_u, + G4double beta_v, + G4double beta_w) { - G4ThreeVector empty = G4ThreeVector(0, 0, 0) ; + G4ThreeVector empty = G4ThreeVector(0, 0, 0); - m_DefinitionType.push_back(false) ; + m_DefinitionType.push_back(false); - m_R.push_back(R) ; - m_Theta.push_back(Theta) ; - m_Phi.push_back(Phi) ; - m_beta_u.push_back(beta_u) ; - m_beta_v.push_back(beta_v) ; - m_beta_w.push_back(beta_w) ; + m_R.push_back(R); + m_Theta.push_back(Theta); + m_Phi.push_back(Phi); + m_beta_u.push_back(beta_u); + m_beta_v.push_back(beta_v); + m_beta_w.push_back(beta_w); - m_TL.push_back(empty) ; - m_BL.push_back(empty) ; - m_BR.push_back(empty) ; - m_TR.push_back(empty) ; + m_TL.push_back(empty); + m_BL.push_back(empty); + m_BR.push_back(empty); + m_TR.push_back(empty); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void ThinSi::VolumeMaker( G4int DetNumber , - G4ThreeVector Det_pos , - G4RotationMatrix* Det_rot , - G4LogicalVolume* world ) +void ThinSi::VolumeMaker( G4int DetNumber , + G4ThreeVector Det_pos , + G4RotationMatrix* Det_rot , + G4LogicalVolume* world ) { - G4double NbrTelescopes = DetNumber ; - G4String DetectorNumber ; - std::ostringstream Number ; - Number << NbrTelescopes ; - DetectorNumber = Number.str() ; + G4double NbrTelescopes = DetNumber ; + G4String DetectorNumber ; + std::ostringstream Number ; + Number << NbrTelescopes ; + DetectorNumber = Number.str() ; //////////////////////////////////////////////////////////////// @@ -148,70 +148,63 @@ void ThinSi::VolumeMaker( G4int DetNumber , G4LogicalVolume* logicThinSi = new G4LogicalVolume(solidThinSi, m_MaterialVacuum, Name, 0, 0); - PVPBuffer = - new G4PVPlacement(G4Transform3D(*Det_rot, Det_pos) , - logicThinSi , - Name , - world , - false , - 0); + PVPBuffer = new G4PVPlacement( G4Transform3D(*Det_rot, Det_pos) , + logicThinSi , + Name , + world , + false , + 0); // Frame is made of 4 thick box (2 Horizontal and 2 Vertical) G4Box* solidFrameHorizontal = new G4Box(Name + "_Frame", 0.5*SiliconSize, 0.5*(DetectorSize - SiliconSize) / 2, 0.5*FrameThickness*mm) ; G4Box* solidFrameVertical = new G4Box(Name + "_Frame", 0.5*(DetectorSize - SiliconSize) / 2, 0.5*DetectorSize, 0.5*FrameThickness*mm) ; - G4LogicalVolume* logicFrameHorizontal = - new G4LogicalVolume(solidFrameHorizontal, m_MaterialAl, Name, 0, 0); - - G4LogicalVolume* logicFrameVertical = - new G4LogicalVolume(solidFrameVertical, m_MaterialAl, Name, 0, 0); - - G4ThreeVector FrameTopPosition = G4ThreeVector(0 , 0.5 * SiliconSize + 0.5 * (DetectorSize - SiliconSize) / 2 , 0) ; - G4ThreeVector FrameBottomPosition = G4ThreeVector(0 , -0.5 * SiliconSize - 0.5 * (DetectorSize - SiliconSize) / 2 , 0) ; - G4ThreeVector FrameLeftPosition = G4ThreeVector(0.5 * SiliconSize + 0.5 * (DetectorSize - SiliconSize) / 2 , 0 , 0) ; - G4ThreeVector FrameRightPosition = G4ThreeVector(-0.5 * SiliconSize - 0.5 * (DetectorSize - SiliconSize) / 2 , 0 , 0) ; - - - PVPBuffer = - new G4PVPlacement(0 , - FrameTopPosition , - logicFrameHorizontal , - Name + "_Frame" , - logicThinSi , - false , - 0); - - PVPBuffer = - new G4PVPlacement(0 , - FrameBottomPosition , - logicFrameHorizontal , - Name + "_Frame" , - logicThinSi , - false , - 0); - - PVPBuffer = - new G4PVPlacement(0 , - FrameLeftPosition , - logicFrameVertical , - Name + "_Frame" , - logicThinSi , - false , - 0); - - PVPBuffer = - new G4PVPlacement(0 , - FrameRightPosition , - logicFrameVertical , - Name + "_Frame" , - logicThinSi , - false , - 0); + G4LogicalVolume* logicFrameHorizontal = new G4LogicalVolume(solidFrameHorizontal, m_MaterialAl, Name, 0, 0); + + G4LogicalVolume* logicFrameVertical = new G4LogicalVolume(solidFrameVertical, m_MaterialAl, Name, 0, 0); + + G4ThreeVector FrameTopPosition = G4ThreeVector(0 , 0.5 * SiliconSize + 0.5 * (DetectorSize - SiliconSize) / 2 , 0) ; + G4ThreeVector FrameBottomPosition = G4ThreeVector(0 , -0.5 * SiliconSize - 0.5 * (DetectorSize - SiliconSize) / 2 , 0) ; + G4ThreeVector FrameLeftPosition = G4ThreeVector(0.5 * SiliconSize + 0.5 * (DetectorSize - SiliconSize) / 2 , 0 , 0) ; + G4ThreeVector FrameRightPosition = G4ThreeVector(-0.5 * SiliconSize - 0.5 * (DetectorSize - SiliconSize) / 2 , 0 , 0) ; + + + PVPBuffer = new G4PVPlacement( 0, + FrameTopPosition, + logicFrameHorizontal, + Name + "_Frame", + logicThinSi, + false, + 0); + + PVPBuffer = new G4PVPlacement( 0, + FrameBottomPosition, + logicFrameHorizontal, + Name + "_Frame", + logicThinSi, + false, + 0); + + PVPBuffer = new G4PVPlacement( 0, + FrameLeftPosition, + logicFrameVertical, + Name + "_Frame", + logicThinSi, + false, + 0); + + PVPBuffer = new G4PVPlacement( 0, + FrameRightPosition, + logicFrameVertical, + Name + "_Frame", + logicThinSi, + false, + 0); G4ThreeVector posAluFront = G4ThreeVector(0 , 0 , AluStripFront_PosZ) ; - G4ThreeVector posSi = G4ThreeVector(0 , 0 , 0) ; - G4ThreeVector posAluBack = G4ThreeVector(0 , 0 , AluStripBack_PosZ) ; + G4ThreeVector posSi = G4ThreeVector(0 , 0 , 0 ) ; + G4ThreeVector posAluBack = G4ThreeVector(0 , 0 , AluStripBack_PosZ ) ; G4Box* solidAlu = new G4Box("ThinSiAlu", 0.5*SiliconSize, 0.5*SiliconSize, 0.5*AluThickness) ; @@ -227,13 +220,13 @@ void ThinSi::VolumeMaker( G4int DetNumber , G4Box* solidSi = - new G4Box("ThinSi", 0.5*SiliconSize, 0.5*SiliconSize, 0.5*SiliconThickness) ; + new G4Box("ThinSi", 0.5*SiliconSize, 0.5*SiliconSize, 0.5*SiliconThickness); G4LogicalVolume* logicSi = - new G4LogicalVolume(solidSi, m_MaterialSilicon, "logicSi", 0, 0, 0) ; + new G4LogicalVolume(solidSi, m_MaterialSilicon, "logicSi", 0, 0, 0); PVPBuffer = - new G4PVPlacement(0, posSi, logicSi, Name + "_Si", logicThinSi, true, 0) ; + new G4PVPlacement(0, posSi, logicSi, Name + "_Si", logicThinSi, true, 0); //attach it to the Silicon plate logicSi ->SetSensitiveDetector(m_StripScorer); @@ -252,209 +245,209 @@ void ThinSi::ReadConfiguration(string Path) { ifstream ConfigFile ; ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; + string LineBuffer ; + string DataBuffer ; - G4double TLX , BLX , BRX , TRX , TLY , BLY , BRY , TRY , TLZ , BLZ , BRZ , TRZ ; - G4ThreeVector TL , BL , BR , TR ; - G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; - bool check_A = false ; + G4double TLX , BLX , BRX , TRX , TLY , BLY , BRY , TRY , TLZ , BLZ , BRZ , TRZ; + G4ThreeVector TL , BL , BR , TR ; + G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; + bool check_A = false ; bool check_B = false ; - bool check_C = false ; + bool check_C = false ; bool check_D = false ; - bool check_Theta = false ; - bool check_Phi = false ; - bool check_R = false ; - bool check_beta = false ; - bool ReadingStatus = false ; + bool check_Theta = false; + bool check_Phi = false; + bool check_R = false; + bool check_beta = false; + bool ReadingStatus = false; while (!ConfigFile.eof()) - { + { - getline(ConfigFile, LineBuffer); - - // If line is a Start Up ThinSi bloc, Reading toggle to true - if (LineBuffer.compare(0, 6, "ThinSi") == 0) - { - G4cout << "///" << G4endl ; - G4cout << "Detector found: " << G4endl ; - ReadingStatus = true ; - - } - - // Else don't toggle to Reading Block Status - else ReadingStatus = false ; - - // Reading Block - while(ReadingStatus) - { - // Pickup Next Word - ConfigFile >> DataBuffer ; - - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - // Finding another telescope (safety), toggle out - else if (DataBuffer.compare(0, 6, "ThinSi") == 0) { - cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; - ReadingStatus = false ; - } - - //Position method - else if (DataBuffer.compare(0, 3, "A=") == 0) { - check_A = true; - ConfigFile >> DataBuffer ; - TLX = atof(DataBuffer.c_str()) ; - TLX = TLX * mm; - ConfigFile >> DataBuffer ; - TLY = atof(DataBuffer.c_str()) ; - TLY = TLY * mm; - ConfigFile >> DataBuffer ; - TLZ = atof(DataBuffer.c_str()) ; - TLZ = TLZ * mm; - - TL = G4ThreeVector(TLX, TLY, TLZ); - cout << "Top Left position : (" << TLX << ";" << TLY << ";" << TLZ << ")" << endl; - } - - else if (DataBuffer.compare(0, 3, "B=") == 0) { - check_B = true; - ConfigFile >> DataBuffer ; - BLX = atof(DataBuffer.c_str()) ; - BLX = BLX * mm; - ConfigFile >> DataBuffer ; - BLY = atof(DataBuffer.c_str()) ; - BLY = BLY * mm; - ConfigFile >> DataBuffer ; - BLZ = atof(DataBuffer.c_str()) ; - BLZ = BLZ * mm; - - BL = G4ThreeVector(BLX, BLY, BLZ); - cout << "Top Right position : (" << BLX << ";" << BLY << ";" << BLZ << ")" << endl; - } - - else if (DataBuffer.compare(0, 3, "C=") == 0) { - check_C = true; - ConfigFile >> DataBuffer ; - BRX = atof(DataBuffer.c_str()) ; - BRX = BRX * mm; - ConfigFile >> DataBuffer ; - BRY = atof(DataBuffer.c_str()) ; - BRY = BRY * mm; - ConfigFile >> DataBuffer ; - BRZ = atof(DataBuffer.c_str()) ; - BRZ = BRZ * mm; - - BR = G4ThreeVector(BRX, BRY, BRZ); - cout << "Bottom Right position : (" << BRX << ";" << BRY << ";" << BRZ << ")" << endl; - } - - else if (DataBuffer.compare(0, 3, "D=") == 0) { - check_D = true; - ConfigFile >> DataBuffer ; - TRX = atof(DataBuffer.c_str()) ; - TRX = TRX * mm; - ConfigFile >> DataBuffer ; - TRY = atof(DataBuffer.c_str()) ; - TRY = TRY * mm; - ConfigFile >> DataBuffer ; - TRZ = atof(DataBuffer.c_str()) ; - TRZ = TRZ * mm; - - TR = G4ThreeVector(TRX, TRY, TRZ); - G4cout << "Center position : (" << TRX << ";" << TRY << ";" << TRZ << ")" << G4endl << G4endl; - } - - - //Angle method - else if (DataBuffer.compare(0, 6, "THETA=") == 0) { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta * deg; - cout << "Theta: " << Theta / deg << endl; - } - - else if (DataBuffer.compare(0, 4, "PHI=") == 0) { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi * deg; - cout << "Phi: " << Phi / deg << endl; - } - - else if (DataBuffer.compare(0, 2, "R=") == 0) { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R * mm; - cout << "R: " << R*mm << endl; - } - - - else if (DataBuffer.compare(0, 5, "BETA=") == 0) { - check_beta = true; - ConfigFile >> DataBuffer ; - beta_u = atof(DataBuffer.c_str()) ; - beta_u = beta_u * deg ; - ConfigFile >> DataBuffer ; - beta_v = atof(DataBuffer.c_str()) ; - beta_v = beta_v * deg ; - ConfigFile >> DataBuffer ; - beta_w = atof(DataBuffer.c_str()) ; - beta_w = beta_w * deg ; - G4cout << "Beta: " << beta_u / deg << " " << beta_v / deg << " " << beta_w / deg << G4endl ; - } - - /////////////////////////////////////////////////// - // If no Detector Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} - - ///////////////////////////////////////////////// - // If All necessary information there, toggle out - - if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) - { - ReadingStatus = false; - - ///Add The previously define telescope - //With position method - if ((check_A && check_B && check_C && check_D) || !(check_Theta && check_Phi && check_R)) { - AddTelescope( TL , - BL , - BR , - TR ); - } - - //with angle method - else if ((check_Theta && check_Phi && check_R) || !(check_A && check_B && check_C && check_D)) { - AddTelescope( R , - Theta , - Phi , - beta_u , - beta_v , - beta_w ); - } - - // Reinitialisation of Check Boolean - - check_A = false ; - check_B = false ; - check_C = false ; - check_D = false ; - - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; - ReadingStatus = false ; - - } - - } - } + getline(ConfigFile, LineBuffer); + + // If line is a Start Up ThinSi bloc, Reading toggle to true + if (LineBuffer.compare(0, 6, "ThinSi") == 0) + { + G4cout << "///" << G4endl ; + G4cout << "Detector found: " << G4endl ; + ReadingStatus = true ; + + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; + + // Reading Block + while(ReadingStatus) + { + // Pickup Next Word + ConfigFile >> DataBuffer ; + + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 6, "ThinSi") == 0) { + cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; + ReadingStatus = false ; + } + + //Position method + else if (DataBuffer.compare(0, 3, "A=") == 0) { + check_A = true; + ConfigFile >> DataBuffer ; + TLX = atof(DataBuffer.c_str()) ; + TLX = TLX * mm; + ConfigFile >> DataBuffer ; + TLY = atof(DataBuffer.c_str()) ; + TLY = TLY * mm; + ConfigFile >> DataBuffer ; + TLZ = atof(DataBuffer.c_str()) ; + TLZ = TLZ * mm; + + TL = G4ThreeVector(TLX, TLY, TLZ); + cout << "Top Left position : (" << TLX << ";" << TLY << ";" << TLZ << ")" << endl; + } + + else if (DataBuffer.compare(0, 3, "B=") == 0) { + check_B = true; + ConfigFile >> DataBuffer ; + BLX = atof(DataBuffer.c_str()) ; + BLX = BLX * mm; + ConfigFile >> DataBuffer ; + BLY = atof(DataBuffer.c_str()) ; + BLY = BLY * mm; + ConfigFile >> DataBuffer ; + BLZ = atof(DataBuffer.c_str()) ; + BLZ = BLZ * mm; + + BL = G4ThreeVector(BLX, BLY, BLZ); + cout << "Top Right position : (" << BLX << ";" << BLY << ";" << BLZ << ")" << endl; + } + + else if (DataBuffer.compare(0, 3, "C=") == 0) { + check_C = true; + ConfigFile >> DataBuffer ; + BRX = atof(DataBuffer.c_str()) ; + BRX = BRX * mm; + ConfigFile >> DataBuffer ; + BRY = atof(DataBuffer.c_str()) ; + BRY = BRY * mm; + ConfigFile >> DataBuffer ; + BRZ = atof(DataBuffer.c_str()) ; + BRZ = BRZ * mm; + + BR = G4ThreeVector(BRX, BRY, BRZ); + cout << "Bottom Right position : (" << BRX << ";" << BRY << ";" << BRZ << ")" << endl; + } + + else if (DataBuffer.compare(0, 3, "D=") == 0) { + check_D = true; + ConfigFile >> DataBuffer ; + TRX = atof(DataBuffer.c_str()) ; + TRX = TRX * mm; + ConfigFile >> DataBuffer ; + TRY = atof(DataBuffer.c_str()) ; + TRY = TRY * mm; + ConfigFile >> DataBuffer ; + TRZ = atof(DataBuffer.c_str()) ; + TRZ = TRZ * mm; + + TR = G4ThreeVector(TRX, TRY, TRZ); + G4cout << "Center position : (" << TRX << ";" << TRY << ";" << TRZ << ")" << G4endl << G4endl; + } + + + //Angle method + else if (DataBuffer.compare(0, 6, "THETA=") == 0) { + check_Theta = true; + ConfigFile >> DataBuffer ; + Theta = atof(DataBuffer.c_str()) ; + Theta = Theta * deg; + cout << "Theta: " << Theta / deg << endl; + } + + else if (DataBuffer.compare(0, 4, "PHI=") == 0) { + check_Phi = true; + ConfigFile >> DataBuffer ; + Phi = atof(DataBuffer.c_str()) ; + Phi = Phi * deg; + cout << "Phi: " << Phi / deg << endl; + } + + else if (DataBuffer.compare(0, 2, "R=") == 0) { + check_R = true; + ConfigFile >> DataBuffer ; + R = atof(DataBuffer.c_str()) ; + R = R * mm; + cout << "R: " << R*mm << endl; + } + + + else if (DataBuffer.compare(0, 5, "BETA=") == 0) { + check_beta = true; + ConfigFile >> DataBuffer ; + beta_u = atof(DataBuffer.c_str()) ; + beta_u = beta_u * deg ; + ConfigFile >> DataBuffer ; + beta_v = atof(DataBuffer.c_str()) ; + beta_v = beta_v * deg ; + ConfigFile >> DataBuffer ; + beta_w = atof(DataBuffer.c_str()) ; + beta_w = beta_w * deg ; + G4cout << "Beta: " << beta_u / deg << " " << beta_v / deg << " " << beta_w / deg << G4endl ; + } + + /////////////////////////////////////////////////// + // If no Detector Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + + if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) + { + ReadingStatus = false; + + ///Add The previously define telescope + //With position method + if ((check_A && check_B && check_C && check_D) || !(check_Theta && check_Phi && check_R)) { + AddTelescope( TL , + BL , + BR , + TR ); + } + + //with angle method + else if ((check_Theta && check_Phi && check_R) || !(check_A && check_B && check_C && check_D)) { + AddTelescope( R , + Theta , + Phi , + beta_u , + beta_v , + beta_w ); + } + + // Reinitialisation of Check Boolean + + check_A = false ; + check_B = false ; + check_C = false ; + check_D = false ; + + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; + ReadingStatus = false ; + + } + + } + } } @@ -462,13 +455,13 @@ void ThinSi::ReadConfiguration(string Path) // Called After DetecorConstruction::AddDetector Method void ThinSi::ConstructDetector(G4LogicalVolume* world) { - G4RotationMatrix* Det_rot = NULL ; - G4ThreeVector Det_pos = G4ThreeVector(0, 0, 0) ; - G4ThreeVector Det_u = G4ThreeVector(0, 0, 0) ; - G4ThreeVector Det_v = G4ThreeVector(0, 0, 0) ; - G4ThreeVector Det_w = G4ThreeVector(0, 0, 0) ; + G4RotationMatrix* Det_rot = NULL; + G4ThreeVector Det_pos = G4ThreeVector(0, 0, 0); + G4ThreeVector Det_u = G4ThreeVector(0, 0, 0); + G4ThreeVector Det_v = G4ThreeVector(0, 0, 0); + G4ThreeVector Det_w = G4ThreeVector(0, 0, 0); - G4int NumberOfDetector = m_DefinitionType.size() ; + G4int NumberOfDetector = m_DefinitionType.size(); for (G4int i = 0 ; i < NumberOfDetector ; i++) { // By Point @@ -476,12 +469,12 @@ void ThinSi::ConstructDetector(G4LogicalVolume* world) // (u,v,w) unitary vector associated to telescope referencial // (u,v) // to silicon plan // w perpendicular to (u,v) plan and pointing outside - Det_u = m_TL[i] - m_BL[i] ; - Det_u = Det_u.unit() ; - Det_v = m_BR[i] - m_BL[i] ; - Det_v = Det_v.unit() ; - Det_w = Det_u.cross(Det_v) ; - Det_w = Det_w.unit() ; + Det_u = m_TL[i] - m_BL[i]; + Det_u = Det_u.unit(); + Det_v = m_BR[i] - m_BL[i]; + Det_v = Det_v.unit(); + Det_w = Det_u.cross(Det_v); + Det_w = Det_w.unit(); // Passage Matrix from Lab Referential to Telescope Referential // MUST2 Det_rot = new G4RotationMatrix(Det_u, Det_v, Det_w); @@ -491,18 +484,13 @@ void ThinSi::ConstructDetector(G4LogicalVolume* world) // By Angle else { - G4double Theta = m_Theta[i] ; - G4double Phi = m_Phi[i] ; + G4double Theta = m_Theta[i]; + G4double Phi = m_Phi[i]; //This part because if Phi and Theta = 0 equation are false - if (Theta == 0) { - Theta = 0.0001 ; - } - if (Theta == 2*cos(0)) { - Theta = 2 * acos(0) - 0.00001 ; - } - if (Phi == 0) { - Phi = 0.0001 ; - } + if (Theta == 0) Theta = 0.0001; + if (Theta == 2*cos(0)) Theta = 2 * acos(0) - 0.00001; + if (Phi == 0) Phi = 0.0001; + // (u,v,w) unitary vector associated to telescope referencial // (u,v) // to silicon plan @@ -511,8 +499,8 @@ void ThinSi::ConstructDetector(G4LogicalVolume* world) // Theta is angle between position vector and z axis G4double wX = m_R[i] * sin(Theta / rad) * cos(Phi / rad) ; G4double wY = m_R[i] * sin(Theta / rad) * sin(Phi / rad) ; - G4double wZ = m_R[i] * cos(Theta / rad) ; - Det_w = G4ThreeVector(wX, wY, wZ) ; + G4double wZ = m_R[i] * cos(Theta / rad); + Det_w = G4ThreeVector(wX, wY, wZ); // vector corresponding to the center of the module G4ThreeVector CT = Det_w; @@ -561,160 +549,160 @@ void ThinSi::InitializeRootOutput() // Called at in the EventAction::EndOfEventAvtion void ThinSi::ReadSensitive(const G4Event* event) { - m_Event->Clear(); + m_Event->Clear(); ////////////////////////////////////////////////////////////////////////////////////// //////////////////////// Used to Read Event Map of detector ////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// // Si - G4THitsMap<G4int>* DetNbrHitMap ; - G4THitsMap<G4int>* StripNbrHitMap ; - G4THitsMap<G4double>* EnergyHitMap ; - G4THitsMap<G4double>* TimeHitMap ; - - std::map<G4int, G4int*>::iterator DetNbr_itr ; - std::map<G4int, G4int*>::iterator StripNbr_itr ; - std::map<G4int, G4double*>::iterator Energy_itr ; - std::map<G4int, G4double*>::iterator Time_itr ; + G4THitsMap<G4int>* DetNbrHitMap; + G4THitsMap<G4int>* StripNbrHitMap; + G4THitsMap<G4double>* EnergyHitMap; + G4THitsMap<G4double>* TimeHitMap; + + std::map<G4int, G4int*>::iterator DetNbr_itr ; + std::map<G4int, G4int*>::iterator StripNbr_itr ; + std::map<G4int, G4double*>::iterator Energy_itr ; + std::map<G4int, G4double*>::iterator Time_itr ; ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - // Read the Scorer associate to the Silicon Strip - - //DetectorNumber - G4int DetNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/DetectorNumber") ; - DetNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(DetNbrCollectionID)) ; - DetNbr_itr = DetNbrHitMap->GetMap()->begin() ; - - //StripNumber - G4int StripNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/StripNumber") ; - StripNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripNbrCollectionID)) ; - - //Energy - G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/StripEnergy") ; - EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)) ; - - //Time - G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/StripTime") ; - TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)) ; - - G4int sizeN = DetNbrHitMap ->entries() ; - G4int sizeS = StripNbrHitMap ->entries() ; - G4int sizeE = EnergyHitMap ->entries() ; - G4int sizeT = TimeHitMap ->entries() ; + // Read the Scorer associate to the Silicon Strip + + //DetectorNumber + G4int DetNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/DetectorNumber"); + DetNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(DetNbrCollectionID)); + DetNbr_itr = DetNbrHitMap->GetMap()->begin(); + + //StripNumber + G4int StripNbrCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/StripNumber"); + StripNbrHitMap = (G4THitsMap<G4int>*)(event->GetHCofThisEvent()->GetHC(StripNbrCollectionID)); + + //Energy + G4int StripEnergyCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/StripEnergy"); + EnergyHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripEnergyCollectionID)); + + //Time + G4int StripTimeCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("ThinSi_StripScorer/StripTime"); + TimeHitMap = (G4THitsMap<G4double>*)(event->GetHCofThisEvent()->GetHC(StripTimeCollectionID)); + + G4int sizeN = DetNbrHitMap ->entries(); + G4int sizeS = StripNbrHitMap ->entries(); + G4int sizeE = EnergyHitMap ->entries(); + G4int sizeT = TimeHitMap ->entries(); - // Loop on Det Number + // Loop on Det Number for (G4int l = 0 ; l < sizeN ; l++) - { - G4int N = *(DetNbr_itr->second) ; - G4int NTrackID = DetNbr_itr->first - N ; - - if (N > 0) - { - m_Event->SetEnergyDetectorNbr(N) ; - m_Event->SetTimeDetectorNbr(N) ; - - // Strip Number - StripNbr_itr = StripNbrHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeS ; h++) { - G4int STrackID = StripNbr_itr->first - N ; - G4int S = *(StripNbr_itr->second) ; - - if (STrackID == NTrackID) { - m_Event->SetEnergyStripNbr(S) ; - m_Event->SetTimeStripNbr(S) ; - } - - StripNbr_itr++; - } - - // Energy - Energy_itr = EnergyHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeE ; h++) { - G4int ETrackID = Energy_itr->first - N ; - G4double E = *(Energy_itr->second) ; - - if (ETrackID == NTrackID) { - m_Event->SetEnergy( RandGauss::shoot(E, ResoEnergy ) ) ; - } - - Energy_itr++; - } - - - // Time - Time_itr = TimeHitMap->GetMap()->begin(); - for (G4int h = 0 ; h < sizeT ; h++) { - G4int TTrackID = Time_itr->first - N ; - G4double T = *(Time_itr->second) ; - - if (TTrackID == NTrackID) { - m_Event->SetTime( RandGauss::shoot(T, ResoTime ) ) ; - } - - Time_itr++; - } - - } - - DetNbr_itr++; - } + { + G4int N = *(DetNbr_itr->second); + G4int NTrackID = DetNbr_itr->first - N; + + if (N > 0) + { + m_Event->SetEnergyDetectorNbr(N); + m_Event->SetTimeDetectorNbr(N); + + // Strip Number + StripNbr_itr = StripNbrHitMap->GetMap()->begin(); + for (G4int h = 0 ; h < sizeS ; h++) { + G4int STrackID = StripNbr_itr->first - N ; + G4int S = *(StripNbr_itr->second); + + if (STrackID == NTrackID) { + m_Event->SetEnergyStripNbr(S); + m_Event->SetTimeStripNbr(S); + } + + StripNbr_itr++; + } + + // Energy + Energy_itr = EnergyHitMap->GetMap()->begin(); + for (G4int h = 0 ; h < sizeE ; h++) { + G4int ETrackID = Energy_itr->first - N; + G4double E = *(Energy_itr->second); + + if (ETrackID == NTrackID) { + m_Event->SetEnergy( RandGauss::shoot(E, ResoEnergy ) ); + } + + Energy_itr++; + } + + + // Time + Time_itr = TimeHitMap->GetMap()->begin(); + for (G4int h = 0 ; h < sizeT ; h++) { + G4int TTrackID = Time_itr->first - N ; + G4double T = *(Time_itr->second); + + if (TTrackID == NTrackID) { + m_Event->SetTime( RandGauss::shoot(T, ResoTime ) ); + } + + Time_itr++; + } + + } + + DetNbr_itr++; + } // clear map for next event - DetNbrHitMap ->clear() ; - StripNbrHitMap ->clear() ; - EnergyHitMap ->clear() ; - TimeHitMap ->clear() ; + DetNbrHitMap ->clear(); + StripNbrHitMap ->clear(); + EnergyHitMap ->clear(); + TimeHitMap ->clear(); } void ThinSi::InitializeScorers() - { - - // Silicon Associate Scorer - m_StripScorer = new G4MultiFunctionalDetector("ThinSi_StripScorer"); - - G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber","ThinSi_", 0) ; - G4VPrimitiveScorer* StripNbr = new PSStripNumber("StripNumber",0,SiliconSize, NumberOfStrip) ; - G4VPrimitiveScorer* Energy = new GENERALSCORERS::PSEnergy("StripEnergy","ThinSi_", 0) ; - G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","ThinSi_", 0) ; - - - //and register it to the multifunctionnal detector - m_StripScorer->RegisterPrimitive(DetNbr) ; - m_StripScorer->RegisterPrimitive(StripNbr) ; - m_StripScorer->RegisterPrimitive(Energy) ; - m_StripScorer->RegisterPrimitive(TOF) ; - - // Add All Scorer to the Global Scorer Manager - G4SDManager::GetSDMpointer()->AddNewDetector(m_StripScorer) ; - } + { + + // Silicon Associate Scorer + m_StripScorer = new G4MultiFunctionalDetector("ThinSi_StripScorer"); + + G4VPrimitiveScorer* DetNbr = new GENERALSCORERS::PSDetectorNumber("DetectorNumber","ThinSi_", 0); + G4VPrimitiveScorer* StripNbr = new PSStripNumber("StripNumber",0,SiliconSize, NumberOfStrip); + G4VPrimitiveScorer* Energy = new GENERALSCORERS::PSEnergy("StripEnergy","ThinSi_", 0); + G4VPrimitiveScorer* TOF = new GENERALSCORERS::PSTOF("StripTime","ThinSi_", 0); + + + //and register it to the multifunctionnal detector + m_StripScorer->RegisterPrimitive(DetNbr); + m_StripScorer->RegisterPrimitive(StripNbr); + m_StripScorer->RegisterPrimitive(Energy); + m_StripScorer->RegisterPrimitive(TOF); + + // Add All Scorer to the Global Scorer Manager + G4SDManager::GetSDMpointer()->AddNewDetector(m_StripScorer) ; + } //////////////////////////////////////////////////////////////// /////////////////Material Definition /////////////////////////// //////////////////////////////////////////////////////////////// void ThinSi::InitializeMaterial() - { - - G4Element* N = new G4Element("Nitrogen" , "N" , 7 , 14.01 * g / mole); - G4Element* O = new G4Element("Oxigen" , "O" , 8 , 16.00 * g / mole); - - G4double a, z, density; - // Si - a = 28.0855 * g / mole; - density = 2.321 * g / cm3; - m_MaterialSilicon = new G4Material("Si", z = 14., a, density); - - // Al - density = 2.702 * g / cm3; - a = 26.98 * g / mole; - m_MaterialAl = new G4Material("Al", z = 13., a, density); - - // Vacuum - density = 0.000000001 * mg / cm3; - m_MaterialVacuum = new G4Material("Vacuum", density, 2); - m_MaterialVacuum->AddElement(N, .7); - m_MaterialVacuum->AddElement(O, .3); - } - + { + + G4Element* N = new G4Element("Nitrogen" , "N" , 7 , 14.01 * g / mole); + G4Element* O = new G4Element("Oxigen" , "O" , 8 , 16.00 * g / mole); + + G4double a, z, density; + // Si + a = 28.0855 * g / mole; + density = 2.321 * g / cm3; + m_MaterialSilicon = new G4Material("Si", z = 14., a, density); + + // Al + density = 2.702 * g / cm3; + a = 26.98 * g / mole; + m_MaterialAl = new G4Material("Al", z = 13., a, density); + + // Vacuum + density = 0.000000001 * mg / cm3; + m_MaterialVacuum = new G4Material("Vacuum", density, 2); + m_MaterialVacuum->AddElement(N, .7); + m_MaterialVacuum->AddElement(O, .3); + } + diff --git a/NPSimulation/src/ThinSiScorers.cc b/NPSimulation/src/ThinSiScorers.cc index 6ea27810b..ec0371438 100644 --- a/NPSimulation/src/ThinSiScorers.cc +++ b/NPSimulation/src/ThinSiScorers.cc @@ -35,9 +35,9 @@ using namespace THINSI ; PSStripNumber::PSStripNumber(G4String name, G4int depth, G4double StripPlaneSize, G4int NumberOfStrip) : G4VPrimitiveScorer(name, depth), HCID(-1) { - m_StripPlaneSize = StripPlaneSize ; - m_NumberOfStrip = NumberOfStrip ; - m_StripPitch = m_StripPlaneSize / m_NumberOfStrip ; + m_StripPlaneSize = StripPlaneSize ; + m_NumberOfStrip = NumberOfStrip ; + m_StripPitch = m_StripPlaneSize / m_NumberOfStrip ; } PSStripNumber::~PSStripNumber() @@ -47,7 +47,7 @@ PSStripNumber::~PSStripNumber() G4bool PSStripNumber::ProcessHits(G4Step* aStep, G4TouchableHistory*) { - int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "ThinSi"); + int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "ThinSi"); G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); diff --git a/NPSimulation/src/W1.cc b/NPSimulation/src/W1.cc index 65858527a..7e772c006 100644 --- a/NPSimulation/src/W1.cc +++ b/NPSimulation/src/W1.cc @@ -223,7 +223,7 @@ void W1::ReadConfiguration(string Path) ConfigFile >> DataBuffer; // Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' ); } @@ -334,8 +334,8 @@ void W1::ReadConfiguration(string Path) else if (DataBuffer.compare(0, 4, "VIS=") == 0) { checkVis = true; - ConfigFile >> DataBuffer; - if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; + ConfigFile >> DataBuffer; + if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; } else { -- GitLab