Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Detector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2300,10 +2300,10 @@ inline void Detector::ReadAllAntennaGains(Settings *settings1){
VgainTopFile = string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_TVpol_RealizedGainAndPhase_Copol_Kansas2024.txt";
HgainFile = string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_Hpol_RealizedGainAndPhase_Copol_Kansas2024.txt";
}
else if (settings1->ANTENNA_MODE == 6) { //Adding antenna mode for custom gains.
VgainFile = string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_BVpol_RealizedGainAndPhase_Copol_Custom.txt";
VgainTopFile = string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_TVpol_RealizedGainAndPhase_Copol_Custom.txt";
HgainFile = string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_Hpol_RealizedGainAndPhase_Copol_Custom.txt";
else if (settings1->ANTENNA_MODE == 6) { //Adding antenna mode for custom gains (takes full path).
VgainFile = string( settings1->VPOL_GAIN_FILE );
VgainTopFile = string( settings1->VTOP_GAIN_FILE );
HgainFile = string( settings1->HPOL_GAIN_FILE );
}

// Check for ALL_ANT_V_ON, then set all antennas to VPol if true
Expand Down
61 changes: 57 additions & 4 deletions Settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void Settings::Initialize() {
NDISCONES_PASS=3;

DEBUG=false; // debugging option
outputdir="outputs"; // directory where outputs go
outputdir="outputs"; // directory where outputs go
FREQ_LOW_SEAVEYS=200.E6;
FREQ_HIGH_SEAVEYS=1200.E6;
BW_SEAVEYS=FREQ_HIGH_SEAVEYS-FREQ_LOW_SEAVEYS;
Expand All @@ -46,6 +46,9 @@ outputdir="outputs"; // directory where outputs go

SIGMA_SELECT=0; // when in SIGMAPARAM=1 case, 0 : (default) use mean value, 1 : use upper bound, 2 : use lower bound

HPOL_GAIN_FILE=string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_dipoletest1_output.txt"; // Default to original Ara Data
VTOP_GAIN_FILE=string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_bicone6in_output.txt"; // Default to original Ara Data
VPOL_GAIN_FILE=string(getenv("ARA_SIM_DIR"))+"/data/antennas/realizedGain/ARA_bicone6in_output.txt"; // Default to original Ara Data

// end of values from icemc

Expand Down Expand Up @@ -727,6 +730,30 @@ void Settings::ReadFile(string setupfile) {
else if (label == "ANTENNA_MODE"){
ANTENNA_MODE = atoi(line.substr(line.find_first_of("=") + 1).c_str());
}
else if (label == "VPOL_GAIN_FILE") {
VPOL_GAIN_FILE = ParseFilePath(line);
if (VPOL_GAIN_FILE.empty()) {
std::cerr << "Warning: could not parse path from line: " << line << std::endl;
std::cerr << "Example Input: VPOL_GAIN_FILE=\"path/to/gain/file.txt\"" << std::endl;
std::abort();
}
}
else if (label == "VTOP_GAIN_FILE") {
VTOP_GAIN_FILE = ParseFilePath(line);
if (VTOP_GAIN_FILE.empty()) {
std::cerr << "Warning: could not parse path from line: " << line << std::endl;
std::cerr << "Example Input: VTOP_GAIN_FILE=\"path/to/gain/file.txt\"" << std::endl;
std::abort();
}
}
else if (label == "HPOL_GAIN_FILE") {
HPOL_GAIN_FILE = ParseFilePath(line);
if (HPOL_GAIN_FILE.empty()) {
std::cerr << "Warning: could not parse path from line: " << line << std::endl;
std::cerr << "Example Input: HPOL_GAIN_FILE=\"path/to/gain/file.txt\"" << std::endl;
std::abort();
}
}
else if (label == "IMPEDANCE_RX_VPOL"){
IMPEDANCE_RX_VPOL = atoi(line.substr(line.find_first_of("=") + 1).c_str());
}
Expand Down Expand Up @@ -762,9 +789,6 @@ void Settings::ReadFile(string setupfile) {
SOURCE_DEPTH = atof(line.substr(line.find_first_of("=") + 1).c_str());
}




}
}
setFile.close();
Expand Down Expand Up @@ -1135,6 +1159,16 @@ int Settings::CheckCompatibilitiesSettings() {
num_err++;
}

// checking antenna mode
if (ANTENNA_MODE != 6) {
if (!VPOL_GAIN_FILE.empty() || !VTOP_GAIN_FILE.empty() || !HPOL_GAIN_FILE.empty()) {
std::cerr << "Warning: Custom GAIN_FILE paths provided, "
<< "but ANTENNA_MODE != 6. These files may be ignored." << std::endl;
num_err++;
}
}


return num_err;

}
Expand All @@ -1148,3 +1182,22 @@ void Settings::SetGitCommitHash(){
std::cout<<"The Git Commit Hash: "<<COMMIT_HASH<<std::endl;
}

std::string Settings::ParseFilePath(const std::string& line) {
size_t eq_pos = line.find('=');
if (eq_pos == std::string::npos) {
return "";
}

// Search for the first quote after the '='
size_t quote_start = line.find('"', eq_pos);
if (quote_start == std::string::npos) {
return "";
}

size_t quote_end = line.find('"', quote_start + 1);
if (quote_end == std::string::npos) {
return "";
}

return line.substr(quote_start + 1, quote_end - quote_start - 1);
}
6 changes: 5 additions & 1 deletion Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Settings
void ReadFile(string setupfile);
void ReadEvtFile(string evtfile);
void SetGitCommitHash();
std::string ParseFilePath(const std::string& line);

int CheckCompatibilitiesSettings();// check if settings are not compatible to each other
int CheckCompatibilitiesDetector(Detector *detector);// check if settings are not compatible to each other. checking against initialized Detector *detector object
Expand Down Expand Up @@ -320,7 +321,10 @@ class Settings
// 5: use the Kansas lab measurements that treat top and bottom vpol separately.
// 6: Uses custom antenna models that the user can specify with the custom files in data/antennas/realizedGain
// The related wiki page for antenna models description:http://ara.icecube.wisc.edu/wiki/index.php/Antenna_model

// Beampattern filepath strings
string VPOL_GAIN_FILE;
string VTOP_GAIN_FILE;
string HPOL_GAIN_FILE;
//Impedances of RX and TX antennas. All use the numbering scheme below:
// 0: Simple 50 Ohm impedance model that matches the Zr=50 that's been historically used in AraSim
// 1: Bottom VPol impedance model measured by Mohammad at Kansas
Expand Down