Skip to content
Snippets Groups Projects
Commit b8c515af authored by Adrien Matta's avatar Adrien Matta :skull_crossbones:
Browse files

Merge branch 'NPTool.2.dev' of https://gitlab.in2p3.fr/np/nptool into NPTool.2.dev

parents 801efaff 44449205
No related branches found
No related tags found
No related merge requests found
Pipeline #169029 passed
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
// NPTool header // NPTool header
#include "Nebula.hh" #include "Nebula.hh"
#include "CalorimeterScorers.hh" #include "PlasticBar.hh"
#include "InteractionScorers.hh" #include "InteractionScorers.hh"
#include "RootOutput.h" #include "RootOutput.h"
#include "MaterialManager.hh" #include "MaterialManager.hh"
...@@ -216,7 +216,7 @@ void Nebula::ReadSensitive(const G4Event* ){ ...@@ -216,7 +216,7 @@ void Nebula::ReadSensitive(const G4Event* ){
/////////// ///////////
// Module scorer // 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(); unsigned int size = Scorer->GetMult();
for(unsigned int i = 0 ; i < size ; i++){ for(unsigned int i = 0 ; i < size ; i++){
...@@ -225,8 +225,10 @@ void Nebula::ReadSensitive(const G4Event* ){ ...@@ -225,8 +225,10 @@ void Nebula::ReadSensitive(const G4Event* ){
if(Energy>Nebula_NS::EnergyThreshold){ if(Energy>Nebula_NS::EnergyThreshold){
double Time = RandGauss::shoot(Scorer->GetTime(i),Nebula_NS::ResoTime); double Time = RandGauss::shoot(Scorer->GetTime(i),Nebula_NS::ResoTime);
int DetectorNbr = level[0]; int DetectorNbr = level[0];
//m_Event->SetEnergy(DetectorNbr,Energy); m_Event->SetChargeUp(DetectorNbr,Energy/2);
//m_Event->SetTime(DetectorNbr,Time); 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() { ...@@ -245,18 +247,18 @@ void Nebula::InitializeScorers() {
// Otherwise the scorer is initialise // Otherwise the scorer is initialise
// Module // Module
vector<int> level; level.push_back(0); 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) ; G4VPrimitiveScorer* ModuleInteraction= new InteractionScorers::PS_Interactions("ModuleInteraction",ms_InterCoord, 0) ;
//and register it to the multifunctionnal detector //and register it to the multifunctionnal detector
m_ModuleScorer->RegisterPrimitive(ModuleCalorimeter); m_ModuleScorer->RegisterPrimitive(ModulePlasticBar);
m_ModuleScorer->RegisterPrimitive(ModuleInteraction); m_ModuleScorer->RegisterPrimitive(ModuleInteraction);
G4SDManager::GetSDMpointer()->AddNewDetector(m_ModuleScorer) ; G4SDManager::GetSDMpointer()->AddNewDetector(m_ModuleScorer) ;
// Veto // 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) ; G4VPrimitiveScorer* VetoInteraction= new InteractionScorers::PS_Interactions("VetoInteraction",ms_InterCoord, 0) ;
//and register it to the multifunctionnal detector //and register it to the multifunctionnal detector
m_VetoScorer->RegisterPrimitive(VetoCalorimeter); m_VetoScorer->RegisterPrimitive(VetoPlasticBar);
m_VetoScorer->RegisterPrimitive(VetoInteraction); m_VetoScorer->RegisterPrimitive(VetoInteraction);
G4SDManager::GetSDMpointer()->AddNewDetector(m_VetoScorer) ; G4SDManager::GetSDMpointer()->AddNewDetector(m_VetoScorer) ;
......
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) target_link_libraries(NPSScorers ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPInitialConditions -lNPInteractionCoordinates)
/*****************************************************************************
* 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......
#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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Target Target
THICKNESS= 10 micrometer THICKNESS= 0.49 cm
RADIUS= 20 mm RADIUS= 28 mm
MATERIAL= CD2 MATERIAL= Vacuum
ANGLE= 0 deg ANGLE= 0 deg
X= 0 mm X= 3.5 cm
Y= 0 mm Y= 0 mm
Z= -4000 mm Z= 0 mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEBULA NEBULA
POS= 0 0 5 m POS= 0 0 12 m
NumberOfModule= 30 NumberOfModule= 15
Veto= 1 Veto= 1
Frame= 1 Frame= 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEBULA NEBULA
POS= 0 0 5.15 m POS= 0 0 12.15 m
NumberOfModule= 30 NumberOfModule= 15
Veto= 0 Veto= 0
Frame= 0 Frame= 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEBULA NEBULA
POS= 0 0 10 m POS= 0 0 16 m
NumberOfModule= 30 NumberOfModule= 30
Veto= 1 Veto= 1
Frame= 1 Frame= 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEBULA NEBULA
POS= 0 0 10.15 m POS= 0 0 16.15 m
NumberOfModule= 30 NumberOfModule= 30
Veto= 0 Veto= 0
Frame= 0 Frame= 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEBULA NEBULA
POS= 0 0 3 m POS= 0 0 18 m
NumberOfModule= 15 NumberOfModule= 30
Veto= 1 Veto= 1
Frame= 1 Frame= 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEBULA NEBULA
POS= 0 0 3.15 m POS= 0 0 18.15 m
NumberOfModule= 15 NumberOfModule= 30
Veto= 0 Veto= 0
Frame= 0 Frame= 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Samurai %Samurai
% POS= 0 0 0 mm % POS= 0 0 0 mm
...@@ -78,4 +78,4 @@ NEBULA ...@@ -78,4 +78,4 @@ NEBULA
% %InvertY= 1 % %InvertY= 1
% %InvertD= 1 % %InvertD= 1
%
EmPhysicsList Option4
DefaultCutOff 1
IonBinaryCascadePhysics 0
NPIonInelasticPhysics 0
EmExtraPhysics 0
HadronElasticPhysics 0
StoppingPhysics 0
OpticalPhysics 0
HadronPhysicsINCLXX 0
HadronPhysicsQGSP_BIC_HP 1
Decay 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
0 1
90 1
180 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment