Commit 1ec3592c authored by Morfouace's avatar Morfouace
Browse files

Adding Twin Music to Sofia

parent f24cc83e
Pipeline #92422 passed with stages
in 20 minutes
......@@ -44,11 +44,17 @@ TSofiaData::~TSofiaData() {
//////////////////////////////////////////////////////////////////////
void TSofiaData::Clear() {
// Energy
// TOF
fTOF_DetectorNbr.clear();
fTOF_PlasticNbr.clear();
fTOF_Energy.clear();
fTOF_Time.clear();
// TWIN
fTWIN_SectorNbr.clear();
fTWIN_AnodeNbr.clear();
fTWIN_AnodeEnergy.clear();
fTWIN_AnodeTime.clear();
}
......@@ -60,6 +66,7 @@ void TSofiaData::Dump() const {
// Energy
size_t mysize = fTOF_DetectorNbr.size();
cout << "TWIN_Mult: " << GetTwinMult() << endl;
cout << "TOF_Mult: " << mysize << endl;
}
......@@ -34,11 +34,17 @@ class TSofiaData : public TObject {
// data members are hold into vectors in order
// to allow multiplicity treatment
private:
// TOF //
vector<int> fTOF_DetectorNbr;
vector<int> fTOF_PlasticNbr;
vector<double> fTOF_Energy;
vector<double> fTOF_Time;
// TWIN MUSIC //
vector<int> fTWIN_SectorNbr;
vector<int> fTWIN_AnodeNbr;
vector<double> fTWIN_AnodeEnergy;
vector<double> fTWIN_AnodeTime;
//////////////////////////////////////////////////////////////
......@@ -63,21 +69,32 @@ class TSofiaData : public TObject {
// add //! to avoid ROOT creating dictionnary for the methods
public:
////////////////////// SETTERS ////////////////////////
// TOF
inline void SetDetectorNbr(int det){fTOF_DetectorNbr.push_back(det);};//!
inline void SetPlasticNbr(int plastic){fTOF_PlasticNbr.push_back(plastic);};//!
inline void SetEnergy(double Energy){fTOF_Energy.push_back(Energy);};//!
inline void SetTime(double Time){fTOF_Time.push_back(Time);};//!
// TWIN
inline void SetTwinSectorNbr(int Sector){fTWIN_SectorNbr.push_back(Sector);};//!
inline void SetTwinAnodeNbr(int Anode){fTWIN_AnodeNbr.push_back(Anode);};//!
inline void SetTwinAnodeEnergy(double Energy){fTWIN_AnodeEnergy.push_back(Energy);};//!
inline void SetTwinAnodeTime(double Time){fTWIN_AnodeTime.push_back(Time);};//!
////////////////////// GETTERS ////////////////////////
// Energy
inline int GetMultiplicity() const {return fTOF_PlasticNbr.size();}
// TOF
inline int GetMultiplicity() const {return fTOF_PlasticNbr.size();}//!
inline int GetDetectorNbr(const unsigned int &i) const {return fTOF_DetectorNbr[i];}//!
inline int GetPlasticNbr(const unsigned int &i) const {return fTOF_PlasticNbr[i];}//!
inline double GetEnergy(const unsigned int &i) const {return fTOF_Energy[i];}//!
inline double GetTime(const unsigned int &i) const {return fTOF_Time[i];}//!
// TWIN
inline int GetTwinMult() const {return fTWIN_AnodeNbr.size();}//!
inline int GetTwinSectorNbr(const unsigned int &i) const {return fTWIN_SectorNbr[i];}//!
inline int GetTwinAnodeNbr(const unsigned int &i) const {return fTWIN_AnodeNbr[i];}//!
inline double GetTwinAnodeEnergy(const unsigned int &i) const {return fTWIN_AnodeEnergy[i];}//!
inline double GetTwinAnodeTime(const unsigned int &i) const {return fTWIN_AnodeTime[i];}//!
//////////////////////////////////////////////////////////////
// Required for ROOT dictionnary
......
......@@ -63,6 +63,7 @@ namespace Sofia_NS{
const double EnergyThreshold = 0.1*MeV;
const double ResoTime = 0.007*ns;
const double ResoEnergy = 1.0*MeV;
const double TwinResoEnergy = 0*keV;
const double tof_plastic_height = 660*mm;
const double tof_plastic_width = 32*mm;
const double tof_plastic_thickness = 0.5*mm;
......@@ -72,6 +73,15 @@ namespace Sofia_NS{
const double GLAD_width = 5*m;
const double GLAD_length = 2*m;
const double twin_anode_width = 10.*cm;
const double twin_anode_height = 10.*cm;
const double twin_anode_thickness = 3.1*cm;
const double twin_cathode_width = 30*um;
const double twin_cathode_height = 20*cm;
const double twin_cathode_thickness = 50*cm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -80,14 +90,25 @@ namespace Sofia_NS{
Sofia::Sofia(){
m_Event = new TSofiaData() ;
m_TofScorer = 0;
m_TwinScorer = 0;
m_PlasticTof = 0;
m_AnodeDriftArea= 0;
m_TwinMusic= 0;
m_TofWall = 0;
m_Build_GLAD= 0;
m_GLAD_MagField = 0;
m_GLAD_DistanceFromTarget = 0;
m_Build_Twin_Music= 0;
m_Twin_Music_DistanceFromTarget= 0;
m_Twin_Music_Gas= "P10_1atm";
// RGB Color + Transparency
m_VisSquare = new G4VisAttributes(G4Colour(0.3, 0.8, 0.2, 0.5));
m_VisSquare = new G4VisAttributes(G4Colour(0.53, 0.81, 0.98, 0.5));
m_VisGLAD = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5, 0.5));
m_VisTwin = new G4VisAttributes(G4Colour(0.7, 0.5, 0.5, 0.5));
}
Sofia::~Sofia(){
......@@ -136,6 +157,99 @@ G4AssemblyVolume* Sofia::BuildTOFDetector(){
return m_TofWall;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4LogicalVolume* Sofia::BuildTwinMusic(){
double twin_width = 21*cm;
double twin_height = 21*cm;
double twin_thickness = 51*cm;
double sector_width = 10*cm;
double sector_height = 10*cm;
double sector_thickness = 50*cm;
if(m_Build_Twin_Music==1){
if(!m_TwinMusic){
// Full Twin volume
G4Box* Twinbox = new G4Box("Twin_Box", twin_width*0.5, twin_height*0.5, twin_thickness*0.5);
G4Material* TwinMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary("Vacuum");
m_TwinMusic = new G4LogicalVolume(Twinbox, TwinMaterial, "logic_twin", 0,0,0);
G4VisAttributes* m_VisDet = new G4VisAttributes(G4Colour(0.5,0.5,0.5,0.3));
m_VisDet->SetForceWireframe(1);
m_TwinMusic->SetVisAttributes(m_VisDet);
// Sector Twin volume
G4Box* Sectorbox = new G4Box("Sector_Box", sector_width*0.5, sector_height*0.5, sector_thickness*0.5);
G4LogicalVolume* LogicalSector = new G4LogicalVolume(Sectorbox, TwinMaterial, "logic_twin", 0,0,0);
LogicalSector->SetVisAttributes(G4VisAttributes::GetInvisible());
// Drift Anode Area //
G4Box* Anodebox = new G4Box("Anode_Box", Sofia_NS::twin_anode_width*0.5, Sofia_NS::twin_anode_height*0.5, Sofia_NS::twin_anode_thickness*0.5);
G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(m_Twin_Music_Gas);
m_AnodeDriftArea = new G4LogicalVolume(Anodebox, DetectorMaterial, "logic_twin_anode", 0, 0, 0);
m_AnodeDriftArea->SetVisAttributes(m_VisTwin);
m_AnodeDriftArea->SetSensitiveDetector(m_TwinScorer);
// Cathode plane in the middle //
G4Box* cathode_box = new G4Box("Cathode_box", Sofia_NS::twin_cathode_width*0.5, Sofia_NS::twin_cathode_height*0.5, Sofia_NS::twin_cathode_thickness*0.5);
G4Material* CathodeMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary("Al");
G4VisAttributes* m_VisCathode = new G4VisAttributes(G4Colour(0.7,0.4,0,1));
G4LogicalVolume* LogicalCathode = new G4LogicalVolume(cathode_box, CathodeMaterial, "logic_cathode", 0,0,0);
LogicalCathode->SetVisAttributes(m_VisCathode);
//G4RotationMatrix* Rv = new G4RotationMatrix(0,0,0);
G4ThreeVector Tv;
Tv.setX(0);
Tv.setY(0);
Tv.setZ(0);
new G4PVPlacement(0, Tv,
LogicalCathode,
"Cathode",
m_TwinMusic, false, 0);
int anode_nbr= 0;
for(unsigned int j=0; j<16; j++){
anode_nbr++;
Tv.setZ(j*Sofia_NS::twin_anode_thickness -7.5*Sofia_NS::twin_anode_thickness);
new G4PVPlacement(0,Tv,
m_AnodeDriftArea,
"Anode",
LogicalSector, false, anode_nbr);
}
for(unsigned int i=0; i<4; i++){
if(i==0){
Tv.setX(0.5*Sofia_NS::twin_anode_width+Sofia_NS::twin_cathode_width);
Tv.setY(0.5*Sofia_NS::twin_anode_height);
}
if(i==1){
Tv.setX(-0.5*Sofia_NS::twin_anode_width-Sofia_NS::twin_cathode_width);
Tv.setY(0.5*Sofia_NS::twin_anode_height);
}
if(i==2){
Tv.setX(-0.5*Sofia_NS::twin_anode_width-Sofia_NS::twin_cathode_width);
Tv.setY(-0.5*Sofia_NS::twin_anode_height);
}
if(i==3){
Tv.setX(0.5*Sofia_NS::twin_anode_width+Sofia_NS::twin_cathode_width);
Tv.setY(-0.5*Sofia_NS::twin_anode_height);
}
Tv.setZ(0);
new G4PVPlacement(0,Tv,
LogicalSector,
"Sector",
m_TwinMusic,false,i+1);
}
}
}
return m_TwinMusic;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4LogicalVolume* Sofia::BuildGLAD()
{
......@@ -146,15 +260,15 @@ G4LogicalVolume* Sofia::BuildGLAD()
m_GLAD = new G4LogicalVolume(box,GLADMaterial,"logic_GLAD_Box",0,0,0);
m_GLAD->SetVisAttributes(m_VisGLAD);
G4UniformMagField* magField = new G4UniformMagField(G4ThreeVector(0,m_GLAD_MagField,0));
//G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
G4FieldManager* fieldMgr = new G4FieldManager(magField);
//fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
m_GLAD->SetFieldManager(fieldMgr,true);
return m_GLAD;
......@@ -172,8 +286,8 @@ void Sofia::ReadConfiguration(NPL::InputParser parser){
if(NPOptionManager::getInstance()->GetVerboseLevel())
cout << "//// " << blocks.size() << " detectors found " << endl;
vector<string> cart = {"POS","Build_GLAD"};
vector<string> sphe = {"R","Theta","Phi","Build_GLAD"};
vector<string> cart = {"POS","Build_GLAD","Build_Twin_Music"};
vector<string> sphe = {"R","Theta","Phi","Build_GLAD","Build_Twin_Music"};
for(unsigned int i = 0 ; i < blocks.size() ; i++){
if(blocks[i]->HasTokenList(cart)){
......@@ -182,6 +296,7 @@ void Sofia::ReadConfiguration(NPL::InputParser parser){
G4ThreeVector Pos = NPS::ConvertVector(blocks[i]->GetTVector3("POS","mm"));
m_Build_GLAD = blocks[i]->GetInt("Build_GLAD");
m_Build_Twin_Music = blocks[i]->GetInt("Build_Twin_Music");
AddDetector(Pos);
}
else if(blocks[i]->HasTokenList(sphe)){
......@@ -193,6 +308,11 @@ void Sofia::ReadConfiguration(NPL::InputParser parser){
m_Build_GLAD = blocks[i]->GetInt("Build_GLAD");
m_GLAD_MagField = blocks[i]->GetDouble("GLAD_MagField","T");
m_GLAD_DistanceFromTarget = blocks[i]->GetDouble("GLAD_DistanceFromTarget", "m");
m_Build_Twin_Music = blocks[i]->GetInt("Build_Twin_Music");
m_Twin_Music_DistanceFromTarget = blocks[i]->GetDouble("Twin_Music_DistanceFromTarget", "m");
m_Twin_Music_Gas = blocks[i]->GetString("Twin_Music_Gas");
AddDetector(R,Theta,Phi);
}
else{
......@@ -240,7 +360,15 @@ void Sofia::ConstructDetector(G4LogicalVolume* world){
world, false, 0);
}
if(m_Build_Twin_Music==1){
G4ThreeVector Tv = G4ThreeVector(0,0,0);
Tv.setZ(m_Twin_Music_DistanceFromTarget);
new G4PVPlacement(0, Tv,
BuildTwinMusic(),
"Twin",
world, false, 0);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -262,7 +390,7 @@ void Sofia::ReadSensitive(const G4Event* ){
m_Event->Clear();
///////////
// Calorimeter scorer
// TOF scorer
CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_TofScorer->GetPrimitive(0);
unsigned int size = Scorer->GetMult();
......@@ -277,11 +405,30 @@ void Sofia::ReadSensitive(const G4Event* ){
m_Event->SetPlasticNbr(PlasticNbr);
m_Event->SetEnergy(Energy);
m_Event->SetTime(Time);
//cout << DetectorNbr << " " << PlasticNbr << " " << Energy << " " << Time << endl;
}
}
//m_Event->Dump();
Scorer->clear();
///////////
// Twin scorer
CalorimeterScorers::PS_Calorimeter* TwinScorer= (CalorimeterScorers::PS_Calorimeter*) m_TwinScorer->GetPrimitive(0);
unsigned int twin_size = TwinScorer->GetMult();
for(unsigned int i = 0 ; i < twin_size ; i++){
vector<unsigned int> level = TwinScorer->GetLevel(i);
double Energy = RandGauss::shoot(TwinScorer->GetEnergy(i),Sofia_NS::TwinResoEnergy);
if(Energy>Sofia_NS::EnergyThreshold){
double Time = RandGauss::shoot(TwinScorer->GetTime(i),Sofia_NS::ResoTime);
int SectorNbr = level[0];
int PlasticNbr = level[1];
m_Event->SetTwinSectorNbr(SectorNbr);
m_Event->SetTwinAnodeNbr(PlasticNbr);
m_Event->SetTwinAnodeEnergy(Energy);
m_Event->SetTwinAnodeTime(Time);
}
}
TwinScorer->clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -289,7 +436,8 @@ void Sofia::ReadSensitive(const G4Event* ){
void Sofia::InitializeScorers() {
// This check is necessary in case the geometry is reloaded
bool already_exist = false;
m_TofScorer = CheckScorer("SofiaScorer",already_exist) ;
m_TofScorer = CheckScorer("TofScorer",already_exist) ;
m_TwinScorer = CheckScorer("TwinScorer",already_exist) ;
if(already_exist)
return ;
......@@ -299,11 +447,15 @@ void Sofia::InitializeScorers() {
level.push_back(1);
level.push_back(0);
G4VPrimitiveScorer* Calorimeter= new CalorimeterScorers::PS_Calorimeter("Calorimeter",level, 0) ;
G4VPrimitiveScorer* TwinCalorimeter= new CalorimeterScorers::PS_Calorimeter("TwinCalorimeter",level, 0) ;
G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ;
//and register it to the multifunctionnal detector
m_TofScorer->RegisterPrimitive(Calorimeter);
m_TofScorer->RegisterPrimitive(Interaction);
G4SDManager::GetSDMpointer()->AddNewDetector(m_TofScorer) ;
m_TwinScorer->RegisterPrimitive(TwinCalorimeter);
G4SDManager::GetSDMpointer()->AddNewDetector(m_TwinScorer) ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......
......@@ -58,11 +58,14 @@ class Sofia : public NPS::VDetector{
G4AssemblyVolume* BuildTOFDetector();
G4LogicalVolume* BuildGLAD();
G4LogicalVolume* BuildTwinMusic();
private:
G4LogicalVolume* m_PlasticTof;
G4LogicalVolume* m_GLAD;
G4AssemblyVolume* m_TofWall;
G4LogicalVolume* m_TwinMusic;
G4LogicalVolume* m_AnodeDriftArea;
////////////////////////////////////////////////////
////// Inherite from NPS::VDetector class /////////
......@@ -90,6 +93,7 @@ class Sofia : public NPS::VDetector{
// Associated Scorer
G4MultiFunctionalDetector* m_TofScorer ;
G4MultiFunctionalDetector* m_TwinScorer ;
////////////////////////////////////////////////////
///////////Event class to store Data////////////////
////////////////////////////////////////////////////
......@@ -105,13 +109,20 @@ class Sofia : public NPS::VDetector{
vector<double> m_Theta;
vector<double> m_Phi;
// GLAD //
int m_Build_GLAD;
double m_GLAD_MagField;
double m_GLAD_DistanceFromTarget;
// Twin Music //
int m_Build_Twin_Music;
double m_Twin_Music_DistanceFromTarget;
string m_Twin_Music_Gas;
// Visualisation Attribute
G4VisAttributes* m_VisSquare;
G4VisAttributes* m_VisGLAD;
G4VisAttributes* m_VisTwin;
// Needed for dynamic loading of the library
public:
......
......@@ -33,7 +33,7 @@ Analysis::~Analysis(){
////////////////////////////////////////////////////////////////////////////////
void Analysis::Init(){
Sofia= (TSofiaPhysicsPhysics*) m_DetectorManager->GetDetector("Sofia");
Sofia= (TSofiaPhysics*) m_DetectorManager->GetDetector("Sofia");
}
////////////////////////////////////////////////////////////////////////////////
......
EmPhysicsList Option4
DefaultCutOff 100
DefaultCutOff 10000
IonBinaryCascadePhysics 0
NPIonInelasticPhysics 0
EmExtraPhysics 0
......
......@@ -13,7 +13,10 @@ Sofia
THETA= -9 deg
PHI= 0 deg
Build_GLAD= 1
GLAD_DistanceFromTarget= 3.5 m
GLAD_DistanceFromTarget= 3.3 m
GLAD_MagField= 1.8 T
Build_Twin_Music= 1
Twin_Music_DistanceFromTarget= 1.5 m
Twin_Music_Gas= P10_1atm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment