Skip to content
Snippets Groups Projects
Commit 269775b7 authored by matta's avatar matta
Browse files

* Add support for different type of location for input file of NPBeam

 - Try as an absolute or relative path
 - if fail try in the standard location
 - if fail exit with error code 1
parent 352b29c1
No related branches found
No related tags found
No related merge requests found
......@@ -89,7 +89,6 @@ void Beam::ReadConfigurationFile(string Path){
string DataBuffer;
//////////////////////////////////////////////////////////////////////////////////////////
ifstream ReactionFile;
ReactionFile.open(Path.c_str());
bool ReadingStatus = false ;
bool check_BeamName = false ;
......@@ -111,11 +110,21 @@ void Beam::ReadConfigurationFile(string Path){
bool check_AllEnergy = false;
bool check_AllEmittance = false;
if (!ReactionFile.is_open()) {
cout << "Error: File " << Path << " not found" << endl ;
exit(1);
ifstream ReactionFile;
string GlobalPath = getenv("NPTOOL");
string StandardPath = GlobalPath + "/Inputs/EventGenerator/" + Path;
ReactionFile.open(StandardPath.c_str());
if (ReactionFile.is_open()) {cout << "Reading Reaction File " << Path << endl ;}
// In case the file is not found in the standard path, the programm try to interpret the file name as an absolute or relative file path.
else{
ReactionFile.open( Path.c_str() );
if(ReactionFile.is_open()) { if(fVerboseLevel==1) cout << "Reading Reaction File " << Path << endl;}
else {cout << "Reaction File " << Path << " not found" << endl;exit(1);}
}
while (!ReactionFile.eof()) {
//Pick-up next line
getline(ReactionFile, LineBuffer);
......
......@@ -464,16 +464,15 @@ void Sharc::ConstructBOXDetector(G4LogicalVolume* world){
///////////////////////////////////////////////////////////////////////////////////
// Place the detector in the world
// Position of the center of the PCB
G4double Exposed_Length= BOX_Wafer_Length + BOX_PCB_Slot_Border + BOX_PCB_Slot_Width;
G4double DetectorOffset= -0.5*(BOX_PCB_Length-Exposed_Length);
// G4double Exposed_Length= BOX_Wafer_Length + BOX_PCB_Slot_Border + BOX_PCB_Slot_Width;
// G4double DetectorOffset= -0.5*(BOX_PCB_Length-Exposed_Length);
/*FIXME*///////////////////////////////////////////
G4ThreeVector DetectorPosition =
G4ThreeVector(DetectorOffset+0.25*mm,Box_Wafer_Offset.y(),0);
G4ThreeVector(0,Box_Wafer_Offset.y(),0);
// Distance of the PCB to the target
G4ThreeVector DetectorSpacing =
-G4ThreeVector(0, 0,0.5*Exposed_Length);
-G4ThreeVector(0, 0,Box_Wafer_Offset.y()+BOX_PCB_Slot_Position );
// If a PAD is present, DSSD is not in the center of the Slot:
G4ThreeVector PAD_OFFSET=-G4ThreeVector(0.5*PAD_PCB_Thickness,0,0);
......
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