diff --git a/NPSimulation/Detectors/Nebula/Nebula.cc b/NPSimulation/Detectors/Nebula/Nebula.cc index 98648115abb66c4a727571d4b2d433256dd550b0..11d1b18eb5340018635b9ac8e5f80d6bb180fca4 100644 --- a/NPSimulation/Detectors/Nebula/Nebula.cc +++ b/NPSimulation/Detectors/Nebula/Nebula.cc @@ -40,7 +40,7 @@ // NPTool header #include "Nebula.hh" -#include "CalorimeterScorers.hh" +#include "PlasticBar.hh" #include "InteractionScorers.hh" #include "RootOutput.h" #include "MaterialManager.hh" @@ -216,7 +216,7 @@ void Nebula::ReadSensitive(const G4Event* ){ /////////// // Module scorer - CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_ModuleScorer->GetPrimitive(0); + PlasticBar::PS_PlasticBar* Scorer= (PlasticBar::PS_PlasticBar*) m_ModuleScorer->GetPrimitive(0); unsigned int size = Scorer->GetMult(); for(unsigned int i = 0 ; i < size ; i++){ @@ -225,8 +225,10 @@ void Nebula::ReadSensitive(const G4Event* ){ if(Energy>Nebula_NS::EnergyThreshold){ double Time = RandGauss::shoot(Scorer->GetTime(i),Nebula_NS::ResoTime); int DetectorNbr = level[0]; - //m_Event->SetEnergy(DetectorNbr,Energy); - //m_Event->SetTime(DetectorNbr,Time); + m_Event->SetChargeUp(DetectorNbr,Energy/2); + m_Event->SetChargeDown(DetectorNbr,Energy/2); + m_Event->SetTimeUp(DetectorNbr,Time/2); + m_Event->SetTimeDown(DetectorNbr,Time/2); } } } @@ -245,18 +247,18 @@ void Nebula::InitializeScorers() { // Otherwise the scorer is initialise // Module vector<int> level; level.push_back(0); - G4VPrimitiveScorer* ModuleCalorimeter= new CalorimeterScorers::PS_Calorimeter("ModuleCalorimeter",level, 0) ; + G4VPrimitiveScorer* ModulePlasticBar= new PlasticBar::PS_PlasticBar("ModulePlasticBar",level, 0) ; G4VPrimitiveScorer* ModuleInteraction= new InteractionScorers::PS_Interactions("ModuleInteraction",ms_InterCoord, 0) ; //and register it to the multifunctionnal detector - m_ModuleScorer->RegisterPrimitive(ModuleCalorimeter); + m_ModuleScorer->RegisterPrimitive(ModulePlasticBar); m_ModuleScorer->RegisterPrimitive(ModuleInteraction); G4SDManager::GetSDMpointer()->AddNewDetector(m_ModuleScorer) ; // Veto - G4VPrimitiveScorer* VetoCalorimeter= new CalorimeterScorers::PS_Calorimeter("VetoCalorimeter",level, 0) ; + G4VPrimitiveScorer* VetoPlasticBar= new PlasticBar::PS_PlasticBar("VetoPlasticBar",level, 0) ; G4VPrimitiveScorer* VetoInteraction= new InteractionScorers::PS_Interactions("VetoInteraction",ms_InterCoord, 0) ; //and register it to the multifunctionnal detector - m_VetoScorer->RegisterPrimitive(VetoCalorimeter); + m_VetoScorer->RegisterPrimitive(VetoPlasticBar); m_VetoScorer->RegisterPrimitive(VetoInteraction); G4SDManager::GetSDMpointer()->AddNewDetector(m_VetoScorer) ; diff --git a/NPSimulation/Scorers/CMakeLists.txt b/NPSimulation/Scorers/CMakeLists.txt index 8b616543f785535f89c41c19059bcdf52a6c0c9c..6d6e2df09dc0ce1d62d054122ee5d8dd2e64901e 100644 --- a/NPSimulation/Scorers/CMakeLists.txt +++ b/NPSimulation/Scorers/CMakeLists.txt @@ -1,2 +1,2 @@ -add_library(NPSScorers SHARED CylinderTPCScorers.cc DriftChamberScorers.cc NPSHitsMap.hh CalorimeterScorers.cc InteractionScorers.cc DSSDScorers.cc SiliconScorers.cc PhotoDiodeScorers.cc ObsoleteGeneralScorers.cc DriftElectronScorers.cc TPCScorers.cc MDMScorer.cc NeutronDetectorScorers.cc ProcessScorers.cc) +add_library(NPSScorers SHARED CylinderTPCScorers.cc DriftChamberScorers.cc NPSHitsMap.hh CalorimeterScorers.cc InteractionScorers.cc DSSDScorers.cc SiliconScorers.cc PhotoDiodeScorers.cc ObsoleteGeneralScorers.cc DriftElectronScorers.cc TPCScorers.cc MDMScorer.cc NeutronDetectorScorers.cc ProcessScorers.cc PlasticBar.cc) target_link_libraries(NPSScorers ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPInitialConditions -lNPInteractionCoordinates) diff --git a/NPSimulation/Scorers/PlasticBar.cc b/NPSimulation/Scorers/PlasticBar.cc new file mode 100644 index 0000000000000000000000000000000000000000..a81634f1b425c03e808f28ea629913d220bcf3c5 --- /dev/null +++ b/NPSimulation/Scorers/PlasticBar.cc @@ -0,0 +1,106 @@ +/***************************************************************************** + * Copyright (C) 2009-2016 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Adrien MATTA contact address: matta@lpccaen.in2p3.fr * + * * + * Creation Date : February 2013 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * File old the scorer specific to the Sharc Detector * + * * + *---------------------------------------------------------------------------* + * Comment: * + * This new type of scorer is aim to become the standard for DSSD,SSSD and * + * PAD detector (any Silicon Detector) * + *****************************************************************************/ +#include "PlasticBar.hh" +#include "G4UnitsTable.hh" +using namespace PlasticBar; + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +unsigned int +PlasticBarData::CalculateIndex(const vector<unsigned int>& level) { + + unsigned int size = level.size(); + unsigned int result = 0; + unsigned int multiplier = 1; + for (unsigned int i = 0; i < size; i++) { + result += level[i] * multiplier; + multiplier *= 1000; + } + return result; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +vector<PlasticBarData>::iterator +PlasticBarDataVector::find(const unsigned int& index) { + for (vector<PlasticBarData>::iterator it = m_Data.begin(); + it != m_Data.end(); it++) { + if ((*it).GetIndex() == index) + return it; + } + return m_Data.end(); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +PS_PlasticBar::PS_PlasticBar(G4String name, vector<G4int> NestingLevel, + G4int depth) + : G4VPrimitiveScorer(name, depth) { + m_NestingLevel = NestingLevel; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +PS_PlasticBar::~PS_PlasticBar() {} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +G4bool PS_PlasticBar::ProcessHits(G4Step* aStep, G4TouchableHistory*) { + G4String particlename + = aStep->GetTrack()->GetParticleDefinition()->GetParticleName(); + cout << particlename << " has left "; + // Contain Energy, Time + as many copy number as nested volume + unsigned int mysize = m_NestingLevel.size(); + t_Energy = aStep->GetTotalEnergyDeposit(); + cout << t_Energy << " MeV"; + t_Time = aStep->GetPreStepPoint()->GetGlobalTime(); + cout << " after " << t_Time << " ms" << endl; + t_Level.clear(); + for (unsigned int i = 0; i < mysize; i++) { + t_Level.push_back( + aStep->GetPreStepPoint()->GetTouchableHandle()->GetCopyNumber( + m_NestingLevel[i])); + } + // Check if the particle has interact before, if yes, add up the energies. + vector<PlasticBarData>::iterator it; + it = m_Data.find(PlasticBarData::CalculateIndex(t_Level)); + if (it != m_Data.end()) { + it->Add(t_Energy); + } else { + m_Data.Set(t_Energy, t_Time, t_Level); + } + return TRUE; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void PS_PlasticBar::Initialize(G4HCofThisEvent*) { clear(); } + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void PS_PlasticBar::EndOfEvent(G4HCofThisEvent*) {} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void PS_PlasticBar::clear() { + m_Data.clear(); + t_Level.clear(); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void PS_PlasticBar::DrawAll() {} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void PS_PlasticBar::PrintAll() {} +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/NPSimulation/Scorers/PlasticBar.hh b/NPSimulation/Scorers/PlasticBar.hh new file mode 100644 index 0000000000000000000000000000000000000000..0e8a6d29d22384eada715c81e2d694ac3986cada --- /dev/null +++ b/NPSimulation/Scorers/PlasticBar.hh @@ -0,0 +1,125 @@ +#ifndef PlasticBar_h +#define PlasticBar_h 1 +/***************************************************************************** + * Copyright (C) 2009-2016 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Adrien MATTA contact address: matta@lpccaen.in2p3.fr * + * * + * Creation Date : February 2013 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * File old the scorer specific to the Silicon Detector * + * * + *---------------------------------------------------------------------------* + * Comment: * + * This new style of scorer is aim to become the standard way of doing scorer* + * in NPTool. * + *The index is build using the TrackID, Detector Number and Strip Number. * + *The scorer Hold Energy and time together * + *Only one scorer is needed for a detector * + *****************************************************************************/ +#include "G4VPrimitiveScorer.hh" +#include "NPSHitsMap.hh" +//#include "NPSecondaries.hh" + +#include <map> +using namespace std; +using namespace CLHEP; + +namespace PlasticBar { + // Hold One hit info + class PlasticBarData{ + public: + PlasticBarData(const double& Energy,const double& Time,const vector<unsigned int>& Nesting){ + m_Index=CalculateIndex(Nesting); + m_Level=Nesting; + m_Energy=Energy; + m_Time=Time; + }; + ~PlasticBarData(){}; + + private: + unsigned int m_Index; + vector<unsigned int> m_Level; + double m_Energy; + double m_Time; + + public: + static unsigned int CalculateIndex(const vector<unsigned int>& Nesting); + + public: + inline unsigned int GetIndex() const {return m_Index;} + inline vector<unsigned int> GetLevel() const {return m_Level;}; + inline double GetEnergy() const {return m_Energy;}; + inline double GetTime() const {return m_Time;}; + + public: + void Add(const double& Energy) {m_Energy+=Energy;}; + }; + + // Manage a vector of DSSD hit + class PlasticBarDataVector{ + public: + PlasticBarDataVector(){}; + ~PlasticBarDataVector(){}; + + private: + vector<PlasticBarData> m_Data; + + public: + vector<PlasticBarData>::iterator find(const unsigned int& index) ; + inline void clear(){m_Data.clear();} ; + inline vector<PlasticBarData>::iterator end() {return m_Data.end();}; + inline vector<PlasticBarData>::iterator begin() {return m_Data.begin();}; + inline unsigned int size() {return m_Data.size();}; + inline void Add(const unsigned int& index,const double& Energy) {find(index)->Add(Energy);}; + inline void Set(const double& Energy, const double& Time, const vector<unsigned int>& Nesting) {m_Data.push_back(PlasticBarData(Energy,Time,Nesting));}; + PlasticBarData* operator[](const unsigned int& i){return &m_Data[i];}; + }; + + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + class PS_PlasticBar : public G4VPrimitiveScorer{ + + public: // with description + PS_PlasticBar(G4String name, vector<G4int> NestingLevel,G4int depth=0); + ~PS_PlasticBar(); + + + protected: // with description + G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + void Initialize(G4HCofThisEvent*); + void EndOfEvent(G4HCofThisEvent*); + void clear(); + void DrawAll(); + void PrintAll(); + + private: // How much level of volume nesting should be considered + // Give the list of the nesting level at which the copy number should be return. + // 0 is the lowest level possible (the actual volume copy number in which the interaction happen) + vector<G4int> m_NestingLevel; + + private: + PlasticBarDataVector m_Data; + double t_Energy; + double t_Time; + vector<unsigned int> t_Level; + double t_ParticleMultiplicity; + public: + inline unsigned int GetMult() {return m_Data.size();}; + inline double GetEnergy(const unsigned int& i) {return m_Data[i]->GetEnergy();}; + inline double GetTime(const unsigned int& i) {return m_Data[i]->GetTime();}; + inline vector<unsigned int> GetLevel(const unsigned int& i) {return m_Data[i]->GetLevel();}; + }; +} + + +#endif diff --git a/Projects/Nebula/8Hp2p.reaction b/Projects/Nebula/8Hp2p.reaction deleted file mode 100755 index c90a099b52e7923d715e00ef8dcad3fd00d3a5b8..0000000000000000000000000000000000000000 --- a/Projects/Nebula/8Hp2p.reaction +++ /dev/null @@ -1,28 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -Beam - Particle= 8He - Energy= 2000 MeV - SigmaEnergy= 100 MeV - SigmaThetaX= 1 deg - SigmaPhiY= 1 deg - SigmaX= 5 mm - SigmaY= 5 mm - MeanThetaX= 0 deg - MeanPhiY= 0 deg - MeanX= 0 mm - MeanY= 0 mm - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -QFSReaction - Beam= 8He - Target= 1H - Scattered= 1H - KnockedOut= 1H - Heavy= 7H - ExcitationEnergyBeam= 0.0 MeV - ExcitationEnergyHeavy= 3.6800 MeV - MomentumSigma= 50.0 - ShootHeavy= 1 - ShootLight= 1 - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Projects/Nebula/Nebula.detector b/Projects/Nebula/Nebula.detector index bac1199e6a78636a5aacab60a7e097aa72842d1f..bed889732401a0802694eeb598743fa6b3ebca77 100644 --- a/Projects/Nebula/Nebula.detector +++ b/Projects/Nebula/Nebula.detector @@ -1,53 +1,53 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Target - THICKNESS= 10 micrometer - RADIUS= 20 mm - MATERIAL= CD2 + THICKNESS= 0.49 cm + RADIUS= 28 mm + MATERIAL= Vacuum ANGLE= 0 deg - X= 0 mm + X= 3.5 cm Y= 0 mm - Z= -4000 mm + Z= 0 mm +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEBULA - POS= 0 0 5 m - NumberOfModule= 30 + POS= 0 0 12 m + NumberOfModule= 15 Veto= 1 Frame= 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEBULA - POS= 0 0 5.15 m - NumberOfModule= 30 + POS= 0 0 12.15 m + NumberOfModule= 15 Veto= 0 Frame= 0 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEBULA - POS= 0 0 10 m + POS= 0 0 16 m NumberOfModule= 30 Veto= 1 Frame= 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEBULA - POS= 0 0 10.15 m + POS= 0 0 16.15 m NumberOfModule= 30 Veto= 0 Frame= 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEBULA - POS= 0 0 3 m - NumberOfModule= 15 + POS= 0 0 18 m + NumberOfModule= 30 Veto= 1 Frame= 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEBULA - POS= 0 0 3.15 m - NumberOfModule= 15 + POS= 0 0 18.15 m + NumberOfModule= 30 Veto= 0 Frame= 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Samurai % POS= 0 0 0 mm @@ -78,4 +78,4 @@ NEBULA % %InvertY= 1 % %InvertD= 1 -% + diff --git a/Projects/Nebula/PhysicsListOption.txt b/Projects/Nebula/PhysicsListOption.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a32a3b1722a1ec55d040d6e46faf8b513c453a0 --- /dev/null +++ b/Projects/Nebula/PhysicsListOption.txt @@ -0,0 +1,11 @@ +EmPhysicsList Option4 +DefaultCutOff 1 +IonBinaryCascadePhysics 0 +NPIonInelasticPhysics 0 +EmExtraPhysics 0 +HadronElasticPhysics 0 +StoppingPhysics 0 +OpticalPhysics 0 +HadronPhysicsINCLXX 0 +HadronPhysicsQGSP_BIC_HP 1 +Decay 0 diff --git a/Projects/Nebula/SimpleNeutrons.reaction b/Projects/Nebula/SimpleNeutrons.reaction new file mode 100755 index 0000000000000000000000000000000000000000..6f5aea35fb4485aedc285ab8ba581ecc955b4c9a --- /dev/null +++ b/Projects/Nebula/SimpleNeutrons.reaction @@ -0,0 +1,14 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +Beam + Particle= n + Energy= 196 MeV + SigmaEnergy= 0.5 MeV + SigmaThetaX= 0.01 deg + SigmaPhiY= 0.01 deg + SigmaX= 0.5 mm + SigmaY= 0.5 mm + MeanThetaX= 0 deg + MeanPhiY= 0 deg + MeanX= 3.5 cm + MeanY= 0 mm + ZEmission= -1000 mm diff --git a/Projects/Nebula/flat.txt b/Projects/Nebula/flat.txt new file mode 100644 index 0000000000000000000000000000000000000000..09b15128730aecce2f1126bf7937af827eba3712 --- /dev/null +++ b/Projects/Nebula/flat.txt @@ -0,0 +1,3 @@ +0 1 +90 1 +180 1