diff --git a/NPLib/Physics/NPBeam.cxx b/NPLib/Physics/NPBeam.cxx index a7850f136bbdd07f86bbbaf7838a7b02771e6937..dc09f66d129a55cbadd5bd6cba6ba02af18aaee9 100644 --- a/NPLib/Physics/NPBeam.cxx +++ b/NPLib/Physics/NPBeam.cxx @@ -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); diff --git a/NPSimulation/src/Sharc.cc b/NPSimulation/src/Sharc.cc index a5d2468a7f3e84efbab8d34b70b3f6c4c347884b..2cb9396a5364620fe6377d690af8c7cb1ccfd3cc 100644 --- a/NPSimulation/src/Sharc.cc +++ b/NPSimulation/src/Sharc.cc @@ -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);