From 8580a1c0567ae947ffb7760fb7538a421f44b18a Mon Sep 17 00:00:00 2001 From: adrien matta <matta@lpccaen.in2p3.fr> Date: Fri, 24 Jul 2020 14:18:45 +0200 Subject: [PATCH] * adding Rshift in catana as an option in input file --- NPSimulation/Detectors/Catana/Catana.cc | 14 ++++++++------ NPSimulation/Detectors/Catana/Catana.hh | 10 ++++++++-- Projects/Catana/Catana.detector | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/NPSimulation/Detectors/Catana/Catana.cc b/NPSimulation/Detectors/Catana/Catana.cc index c12302a11..b8f07f624 100644 --- a/NPSimulation/Detectors/Catana/Catana.cc +++ b/NPSimulation/Detectors/Catana/Catana.cc @@ -96,7 +96,7 @@ Catana::~Catana(){ } //....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_Y.push_back(Y); m_Z.push_back(Z); @@ -104,10 +104,11 @@ void Catana::AddDetector(double X,double Y, double Z, double Theta, double Phi, m_Phi.push_back(Phi); m_ID.push_back(ID); m_Type.push_back(Type); + m_Rshift.push_back(Rshift); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Catana::ReadCSV(string path){ +void Catana::ReadCSV(string path,double Rshift){ std::ifstream csv(path); if(!csv.is_open()){ std::ostringstream message; @@ -122,7 +123,7 @@ void Catana::ReadCSV(string path){ getline(csv,buffer); while(csv >> ID >> buffer >> type >> buffer >> layer >> buffer >> X >> buffer >> Y >> buffer >> Z >> buffer >> Theta >> buffer >> Phi){ 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{ // ignore other type for which I don't have the geometry } @@ -390,14 +391,15 @@ void Catana::ReadConfiguration(NPL::InputParser parser){ if(NPOptionManager::getInstance()->GetVerboseLevel()) 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++){ if(blocks[i]->HasTokenList(token)){ if(NPOptionManager::getInstance()->GetVerboseLevel()) cout << endl << "//// Catana " << i+1 << endl; string path = blocks[i]->GetString("Path"); - ReadCSV(path); + double Rshift = blocks[i]->GetDouble("Rshift","micrometer"); + ReadCSV(path,Rshift); } else{ cout << "ERROR: check your input file formatting " << endl; @@ -450,7 +452,7 @@ void Catana::ConstructDetector(G4LogicalVolume* world){ Det_dir.unit(); // had to add a 70micron in radius to avoid overlap when using official // 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; G4RotationMatrix* Rot = new G4RotationMatrix(); Rot->rotateX(-m_Theta[i]); diff --git a/NPSimulation/Detectors/Catana/Catana.hh b/NPSimulation/Detectors/Catana/Catana.hh index d5680e98d..5528daf56 100644 --- a/NPSimulation/Detectors/Catana/Catana.hh +++ b/NPSimulation/Detectors/Catana/Catana.hh @@ -52,8 +52,8 @@ class Catana : public NPS::VDetector{ //////////////////////////////////////////////////// public: // Cartesian - void AddDetector(double X, double Y, double Z, double Theta, double Phi, int ID,int Type); - void ReadCSV(string path); + void AddDetector(double X, double Y, double Z, double Theta, double Phi, int ID,int Type,double Rshift=0); + void ReadCSV(string path,double Rshift); G4LogicalVolume* BuildDetector(int Type); @@ -109,6 +109,12 @@ class Catana : public NPS::VDetector{ vector<double> m_Phi; vector<int> m_ID; 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; // Visualisation Attribute diff --git a/Projects/Catana/Catana.detector b/Projects/Catana/Catana.detector index 6d7a466cc..6615ad6f1 100644 --- a/Projects/Catana/Catana.detector +++ b/Projects/Catana/Catana.detector @@ -11,6 +11,7 @@ Target %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Catana CSV Path= Catana.csv + Rshift= 70 micrometer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Catana Detector -- GitLab