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

* adding Rshift in catana as an option in input file

parent 8e54726d
No related branches found
No related tags found
No related merge requests found
Pipeline #77438 passed
...@@ -96,7 +96,7 @@ Catana::~Catana(){ ...@@ -96,7 +96,7 @@ Catana::~Catana(){
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Catana::AddDetector(double X,double Y, double Z, double Theta, double Phi, int ID, int Type){ void Catana::AddDetector(double X,double Y, double Z, double Theta, double Phi, int ID, int Type,double Rshift){
m_X.push_back(X); m_X.push_back(X);
m_Y.push_back(Y); m_Y.push_back(Y);
m_Z.push_back(Z); m_Z.push_back(Z);
...@@ -104,10 +104,11 @@ void Catana::AddDetector(double X,double Y, double Z, double Theta, double Phi, ...@@ -104,10 +104,11 @@ void Catana::AddDetector(double X,double Y, double Z, double Theta, double Phi,
m_Phi.push_back(Phi); m_Phi.push_back(Phi);
m_ID.push_back(ID); m_ID.push_back(ID);
m_Type.push_back(Type); m_Type.push_back(Type);
m_Rshift.push_back(Rshift);
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Catana::ReadCSV(string path){ void Catana::ReadCSV(string path,double Rshift){
std::ifstream csv(path); std::ifstream csv(path);
if(!csv.is_open()){ if(!csv.is_open()){
std::ostringstream message; std::ostringstream message;
...@@ -122,7 +123,7 @@ void Catana::ReadCSV(string path){ ...@@ -122,7 +123,7 @@ void Catana::ReadCSV(string path){
getline(csv,buffer); getline(csv,buffer);
while(csv >> ID >> buffer >> type >> buffer >> layer >> buffer >> X >> buffer >> Y >> buffer >> Z >> buffer >> Theta >> buffer >> Phi){ while(csv >> ID >> buffer >> type >> buffer >> layer >> buffer >> X >> buffer >> Y >> buffer >> Z >> buffer >> Theta >> buffer >> Phi){
if(type<6) if(type<6)
AddDetector(X,Y,Z,Theta*deg,Phi*deg,ID,type); AddDetector(X,Y,Z,Theta*deg,Phi*deg,ID,type,Rshift);
else{ else{
// ignore other type for which I don't have the geometry // ignore other type for which I don't have the geometry
} }
...@@ -390,14 +391,15 @@ void Catana::ReadConfiguration(NPL::InputParser parser){ ...@@ -390,14 +391,15 @@ void Catana::ReadConfiguration(NPL::InputParser parser){
if(NPOptionManager::getInstance()->GetVerboseLevel()) if(NPOptionManager::getInstance()->GetVerboseLevel())
cout << "//// " << blocks.size() << " CSV block found " << endl; cout << "//// " << blocks.size() << " CSV block found " << endl;
vector<string> token = {"Path"}; vector<string> token = {"Path","Rshift"};
for(unsigned int i = 0 ; i < blocks.size() ; i++){ for(unsigned int i = 0 ; i < blocks.size() ; i++){
if(blocks[i]->HasTokenList(token)){ if(blocks[i]->HasTokenList(token)){
if(NPOptionManager::getInstance()->GetVerboseLevel()) if(NPOptionManager::getInstance()->GetVerboseLevel())
cout << endl << "//// Catana " << i+1 << endl; cout << endl << "//// Catana " << i+1 << endl;
string path = blocks[i]->GetString("Path"); string path = blocks[i]->GetString("Path");
ReadCSV(path); double Rshift = blocks[i]->GetDouble("Rshift","micrometer");
ReadCSV(path,Rshift);
} }
else{ else{
cout << "ERROR: check your input file formatting " << endl; cout << "ERROR: check your input file formatting " << endl;
...@@ -450,7 +452,7 @@ void Catana::ConstructDetector(G4LogicalVolume* world){ ...@@ -450,7 +452,7 @@ void Catana::ConstructDetector(G4LogicalVolume* world){
Det_dir.unit(); Det_dir.unit();
// had to add a 70micron in radius to avoid overlap when using official // had to add a 70micron in radius to avoid overlap when using official
// csv simulation file // csv simulation file
Det_dir.setMag(m_Zoffset[m_Type[i]]+0.07); Det_dir.setMag(m_Zoffset[m_Type[i]]+m_Rshift[i]);
Det_pos+=Det_dir; Det_pos+=Det_dir;
G4RotationMatrix* Rot = new G4RotationMatrix(); G4RotationMatrix* Rot = new G4RotationMatrix();
Rot->rotateX(-m_Theta[i]); Rot->rotateX(-m_Theta[i]);
......
...@@ -52,8 +52,8 @@ class Catana : public NPS::VDetector{ ...@@ -52,8 +52,8 @@ class Catana : public NPS::VDetector{
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
public: public:
// Cartesian // Cartesian
void AddDetector(double X, double Y, double Z, double Theta, double Phi, int ID,int Type); void AddDetector(double X, double Y, double Z, double Theta, double Phi, int ID,int Type,double Rshift=0);
void ReadCSV(string path); void ReadCSV(string path,double Rshift);
G4LogicalVolume* BuildDetector(int Type); G4LogicalVolume* BuildDetector(int Type);
...@@ -109,6 +109,12 @@ class Catana : public NPS::VDetector{ ...@@ -109,6 +109,12 @@ class Catana : public NPS::VDetector{
vector<double> m_Phi; vector<double> m_Phi;
vector<int> m_ID; vector<int> m_ID;
vector<int> m_Type; vector<int> m_Type;
// this parameter is here because some csv file have very small overlap
// due to difference between mechanical design and reality of the detector
// a shift is apply to the position of the crystal to slightly icrease the radius
// and avoid shift. Typical value shoulde be < 100um
vector<double> m_Rshift;// additional shift to apply to csv file
// relative shift of crystal w/r to the housing
map<int,double> m_Zoffset; map<int,double> m_Zoffset;
// Visualisation Attribute // Visualisation Attribute
......
...@@ -11,6 +11,7 @@ Target ...@@ -11,6 +11,7 @@ Target
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Catana CSV Catana CSV
Path= Catana.csv Path= Catana.csv
Rshift= 70 micrometer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Catana Detector %Catana Detector
......
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